commit
23ef0fdbf7
|
@ -2,15 +2,14 @@
|
|||
let
|
||||
cfg = config.programs.nix-ld;
|
||||
|
||||
# TODO make glibc here configurable?
|
||||
nix-ld-so = pkgs.runCommand "ld.so" {} ''
|
||||
ln -s "$(cat '${pkgs.stdenv.cc}/nix-support/dynamic-linker')" $out
|
||||
'';
|
||||
|
||||
nix-ld-libraries = pkgs.buildEnv {
|
||||
name = "lb-library-path";
|
||||
pathsToLink = [ "/lib" ];
|
||||
paths = map lib.getLib cfg.libraries;
|
||||
# TODO make glibc here configurable?
|
||||
postBuild = ''
|
||||
ln -s ${pkgs.stdenv.cc.bintools.dynamicLinker} $out/share/nix-ld/lib/ld.so
|
||||
'';
|
||||
extraPrefix = "/share/nix-ld";
|
||||
ignoreCollisions = true;
|
||||
};
|
||||
|
@ -38,12 +37,7 @@ in
|
|||
meta.maintainers = [ lib.maintainers.mic92 ];
|
||||
options.programs.nix-ld = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc ''nix-ld, Documentation: <https://github.com/Mic92/nix-ld>'');
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
description = lib.mdDoc "Which package to use for the nix-ld.";
|
||||
default = pkgs.nix-ld;
|
||||
defaultText = lib.literalExpression "pkgs.nix-ld";
|
||||
};
|
||||
package = lib.mkPackageOptionMD pkgs "nix-ld" { };
|
||||
libraries = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
description = lib.mdDoc "Libraries that automatically become available to all programs. The default set includes common libraries.";
|
||||
|
@ -60,7 +54,7 @@ in
|
|||
environment.pathsToLink = [ "/share/nix-ld" ];
|
||||
|
||||
environment.variables = {
|
||||
NIX_LD = toString nix-ld-so;
|
||||
NIX_LD = "/run/current-system/sw/share/nix-ld/lib/ld.so";
|
||||
NIX_LD_LIBRARY_PATH = "/run/current-system/sw/share/nix-ld/lib";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -13,5 +13,8 @@ import ./make-test-python.nix ({ lib, pkgs, ...} :
|
|||
testScript = ''
|
||||
start_all()
|
||||
machine.succeed("hello")
|
||||
|
||||
# test fallback if NIX_LD is not set
|
||||
machine.succeed("unset NIX_LD; unset NIX_LD_LIBRARY_PATH; hello")
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -12,13 +12,13 @@ let
|
|||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nix-ld";
|
||||
version = "1.1.0";
|
||||
version = "1.2.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mic92";
|
||||
repo = "nix-ld";
|
||||
rev = version;
|
||||
sha256 = "sha256-dM9YPN+yq6sHmRhJQinYdAVXBkTgEtrVQcsd/mIIX0o=";
|
||||
sha256 = "sha256-NitUt9LBJMpAbbKC98aRPYMfxZFq3PHH6ieqM4MVO08=";
|
||||
};
|
||||
|
||||
doCheck = true;
|
||||
|
|
Loading…
Reference in a new issue