2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nix-ld";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "1.2.3";
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mic92";
|
|
|
|
repo = "nix-ld";
|
|
|
|
rev = version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-h+odOVyiGmEERMECoFOj5P7FPiMR8IPRzroFA4sKivg=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ meson ninja ];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dnix-system=${stdenv.system}"
|
|
|
|
];
|
|
|
|
|
|
|
|
hardeningDisable = [
|
|
|
|
"stackprotector"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
ldpath=/${stdenv.hostPlatform.libDir}/$(basename $(< ${stdenv.cc}/nix-support/dynamic-linker))
|
2022-05-18 14:49:53 +00: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
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.nix-ld = nixosTests.nix-ld;
|
|
|
|
|
|
|
|
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-06-16 17:23:12 +00:00
|
|
|
platforms = platforms.linux;
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
2022-05-18 14:49:53 +00:00
|
|
|
}
|