nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 56 lines 1.3 kB view raw
1{ 2 stdenv, 3 fetchFromGitHub, 4 nixosTests, 5 rustPlatform, 6 lib, 7}: 8 9rustPlatform.buildRustPackage rec { 10 pname = "nix-ld"; 11 version = "2.0.6"; 12 13 src = fetchFromGitHub { 14 owner = "nix-community"; 15 repo = "nix-ld"; 16 rev = version; 17 hash = "sha256-I9cEWy07pUNsOfBPG7qMYHx/YmE1uxaadP3ObHu7ALQ="; 18 }; 19 20 cargoHash = "sha256-8mkMq16CfEc/RHH3msXEnoiDHGGRjr2Omp2TVd07ObE="; 21 22 hardeningDisable = [ "stackprotector" ]; 23 24 env = { 25 NIX_SYSTEM = stdenv.system; 26 RUSTC_BOOTSTRAP = "1"; 27 }; 28 29 preCheck = '' 30 export NIX_LD=${stdenv.cc.bintools.dynamicLinker} 31 ''; 32 33 postInstall = '' 34 mkdir -p $out/libexec 35 ln -s $out/bin/nix-ld $out/libexec/nix-ld 36 37 mkdir -p $out/nix-support 38 39 ldpath=/${stdenv.hostPlatform.libDir}/$(basename ${stdenv.cc.bintools.dynamicLinker}) 40 echo "$ldpath" > $out/nix-support/ldpath 41 mkdir -p $out/lib/tmpfiles.d/ 42 cat > $out/lib/tmpfiles.d/nix-ld.conf <<EOF 43 L+ $ldpath - - - - $out/libexec/nix-ld 44 EOF 45 ''; 46 47 passthru.tests = nixosTests.nix-ld; 48 49 meta = { 50 description = "Run unpatched dynamic binaries on NixOS"; 51 homepage = "https://github.com/nix-community/nix-ld"; 52 license = lib.licenses.mit; 53 maintainers = with lib.maintainers; [ mic92 ]; 54 platforms = lib.platforms.linux; 55 }; 56}