2022-05-14 17:02:37 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2023-11-25 04:51:50 +01:00
|
|
|
|
2022-05-14 17:02:37 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nix-ld";
|
2023-12-17 07:26:46 +01:00
|
|
|
version = "1.2.3";
|
2022-05-14 17:02:37 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mic92";
|
|
|
|
repo = "nix-ld";
|
|
|
|
rev = version;
|
2023-12-17 07:26:46 +01:00
|
|
|
hash = "sha256-h+odOVyiGmEERMECoFOj5P7FPiMR8IPRzroFA4sKivg=";
|
2022-05-14 17:02:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ meson ninja ];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dnix-system=${stdenv.system}"
|
|
|
|
];
|
|
|
|
|
|
|
|
hardeningDisable = [
|
|
|
|
"stackprotector"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
2024-03-24 08:49:52 +01:00
|
|
|
ldpath=/${stdenv.hostPlatform.libDir}/$(basename ${stdenv.cc.bintools.dynamicLinker})
|
2022-05-14 17:02:37 +02:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-03-24 08:51:02 +01:00
|
|
|
passthru.tests = nixosTests.nix-ld;
|
2022-05-14 17:02:37 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Run unpatched dynamic binaries on NixOS";
|
|
|
|
homepage = "https://github.com/Mic92/nix-ld";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ mic92 ];
|
2022-05-26 08:07:25 +02:00
|
|
|
platforms = platforms.linux;
|
2022-03-15 13:22:18 +01:00
|
|
|
};
|
2022-05-14 17:02:37 +02:00
|
|
|
}
|