Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LD_LIBRARY_PATH #1

Open
PedroRegisPOAR opened this issue Jun 27, 2021 · 0 comments
Open

LD_LIBRARY_PATH #1

PedroRegisPOAR opened this issue Jun 27, 2021 · 0 comments

Comments

@PedroRegisPOAR
Copy link
Contributor

PedroRegisPOAR commented Jun 27, 2021

let
  libPath = stdenv.lib.makeLibraryPath ([
    ncurses5 gmp
  ] ++ stdenv.lib.optional (stdenv.hostPlatform.isDarwin) libiconv);

  libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY"
    + "LD_LIBRARY_PATH";

  glibcDynLinker = assert stdenv.isLinux;
    if stdenv.hostPlatform.libc == "glibc" then
       # Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
       ''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
    else
      "${stdenv.lib.getLib glibc}/lib/ld-linux*";

in

stdenv.mkDerivation rec {

https://stackoverflow.com/questions/55993023/how-do-i-reference-import-a-derivation-from-a-file-in-nix

export LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:$LD_LIBRARY_PATH

From: nix-community/poetry2nix#46

Related: https://unix.stackexchange.com/a/252232

LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib";

https://nixos.wiki/wiki/OpenGL

TODO: re-test it

{ pkgs ? import <nixpkgs> {}
, lib ? pkgs.stdenv.lib
, mkShell ? pkgs.mkShell
}:

let
  foo = null;

in mkShell rec {
  nativeBuildInputs = (with pkgs; [
    pkgconfig
  ]);

  buildInputs = (with pkgs; [
    cargo
    rustc
    rust-analyzer
    python3
    xlibs.libxcb
    xlibs.libX11.dev
    xlibs.libXcursor
    xlibs.libXrandr
    xlibs.libXi
    wayland
    wayland-protocols
    libGL
    libGLU
    libglvnd
  ]);

  LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
}

https://github.com/Shou/game-rs/blob/master/shell.nix#L31

Relacionado: https://nix.dev/tutorials/declarative-and-reproducible-developer-environments#customizing-your-developer-environment

  devshell = pkgs.devshell.mkShell {
    env = [{
      name = "NODE_ENV";
      value = "development";
    }];
  };

From: https://yuanwang.ca/posts/getting-started-with-flakes.html

An workaround:

LD_LIBRARY_PATH=pkgsAllowUnfree.stdenv.cc.cc.lib + "/lib64";
  env = [
    {
      name = "NIX_CONFIG";
      value =
        ''extra-experimental-features = nix-command flakes ca-references
        extra-substituters = https://nrdxp.cachix.org https://nix-community.cachix.org
        extra-trusted-public-keys = nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs='';
    }
  ];

From: https://github.com/divnix/digga/blob/6549cf4c87d1a77138cbecbc6bb9483c20572cd7/shell.nix#L102-L110

https://github.com/seppeljordan/nix-prefetch-github/blob/907844ec302c598d9ab0c9cb0474c763b10d55e9/flake.nix#L63-L67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant