Merge pull request #237793 from Mic92/nix-ld

nix-ld: 1.1.0 -> 1.2.1
This commit is contained in:
Jörg Thalheim 2023-06-15 08:51:56 +01:00 committed by GitHub
commit 23ef0fdbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 14 deletions

View File

@ -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";
};
};

View File

@ -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")
'';
})

View File

@ -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;