|
|
|
@ -1,12 +1,24 @@ |
|
|
|
|
{ stdenv, meson, ninja, lib, nixosTests, fetchFromGitHub }: |
|
|
|
|
{ lib |
|
|
|
|
, stdenv |
|
|
|
|
, fetchFromGitHub |
|
|
|
|
, meson |
|
|
|
|
, ninja |
|
|
|
|
, nixosTests |
|
|
|
|
}: |
|
|
|
|
let |
|
|
|
|
self = stdenv.mkDerivation { |
|
|
|
|
name = "nix-ld"; |
|
|
|
|
libDir = if builtins.elem stdenv.system [ "x86_64-linux" "mips64-linux" "powerpc64le-linux" ] |
|
|
|
|
then "/lib64" |
|
|
|
|
else "/lib"; |
|
|
|
|
in |
|
|
|
|
stdenv.mkDerivation rec { |
|
|
|
|
pname = "nix-ld"; |
|
|
|
|
version = "1.0.2"; |
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub { |
|
|
|
|
owner = "Mic92"; |
|
|
|
|
owner = "mic92"; |
|
|
|
|
repo = "nix-ld"; |
|
|
|
|
rev = "1.0.0"; |
|
|
|
|
sha256 = "sha256-QYPg8wPpq7q5Xd1jW17Lh36iKFSsVkN/gWYoQRv2XoU="; |
|
|
|
|
rev = version; |
|
|
|
|
sha256 = "sha256-DlWU5i/MykqWgB9vstYbECy3e+XagXWCxi+XDJNey0s="; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
doCheck = true; |
|
|
|
@ -23,27 +35,22 @@ let |
|
|
|
|
|
|
|
|
|
postInstall = '' |
|
|
|
|
mkdir -p $out/nix-support |
|
|
|
|
basename $(< ${stdenv.cc}/nix-support/dynamic-linker) > $out/nix-support/ld-name |
|
|
|
|
|
|
|
|
|
ldpath=${libDir}/$(basename $(< ${stdenv.cc}/nix-support/dynamic-linker)) |
|
|
|
|
echo "$ldpath" > $out/nix-support/ldpath |
|
|
|
|
mkdir -p $out/lib/tmpfiles.d/ |
|
|
|
|
cat > $out/lib/tmpfiles.d/nix-ld.conf <<EOF |
|
|
|
|
L+ $ldpath - - - - $out/libexec/nix-ld |
|
|
|
|
EOF |
|
|
|
|
''; |
|
|
|
|
|
|
|
|
|
passthru.tests.nix-ld = nixosTests.nix-ld; |
|
|
|
|
passthru.ldPath = let |
|
|
|
|
libDir = if stdenv.system == "x86_64-linux" || |
|
|
|
|
stdenv.system == "mips64-linux" || |
|
|
|
|
stdenv.system == "powerpc64le-linux" |
|
|
|
|
then |
|
|
|
|
"/lib64" |
|
|
|
|
else |
|
|
|
|
"/lib"; |
|
|
|
|
ldName = lib.fileContents "${self}/nix-support/ld-name"; |
|
|
|
|
in "${libDir}/${ldName}"; |
|
|
|
|
|
|
|
|
|
meta = with lib; { |
|
|
|
|
description = "Run unpatched dynamic binaries on NixOS"; |
|
|
|
|
homepage = "https://github.com/Mic92/nix-ld"; |
|
|
|
|
license = licenses.mit; |
|
|
|
|
maintainers = with maintainers; [ mic92 ]; |
|
|
|
|
platforms = platforms.linux; |
|
|
|
|
}; |
|
|
|
|
platforms = platforms.unix; |
|
|
|
|
}; |
|
|
|
|
in self |
|
|
|
|
} |
|
|
|
|