|
1 | | -{ lib, system, stdenv, meson, ninja, overrideCC, path, pkgs }: |
2 | | -let |
3 | | - self = stdenv.mkDerivation rec { |
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + meson, |
| 5 | + ninja, |
| 6 | + overrideCC, |
| 7 | + path, |
| 8 | + pkgs, |
| 9 | +}: let |
| 10 | + libDir = |
| 11 | + if |
| 12 | + stdenv.system |
| 13 | + == "x86_64-linux" |
| 14 | + || stdenv.system == "mips64-linux" |
| 15 | + || stdenv.system == "powerpc64le-linux" |
| 16 | + then "/lib64" |
| 17 | + else "/lib"; |
| 18 | +in |
| 19 | + stdenv.mkDerivation rec { |
4 | 20 | name = "nix-ld"; |
5 | 21 | src = ./.; |
6 | 22 |
|
7 | 23 | doCheck = true; |
8 | 24 |
|
9 | | - nativeBuildInputs = [ meson ninja ]; |
| 25 | + nativeBuildInputs = [meson ninja]; |
10 | 26 |
|
11 | 27 | mesonFlags = [ |
12 | | - "-Dnix-system=${system}" |
| 28 | + "-Dnix-system=${stdenv.system}" |
13 | 29 | ]; |
14 | 30 |
|
15 | 31 | hardeningDisable = [ |
|
18 | 34 |
|
19 | 35 | postInstall = '' |
20 | 36 | mkdir -p $out/nix-support |
21 | | - basename $(< ${stdenv.cc}/nix-support/dynamic-linker) > $out/nix-support/ld-name |
| 37 | +
|
| 38 | + ldpath=${libDir}/$(basename $(< ${stdenv.cc}/nix-support/dynamic-linker)) |
| 39 | + echo "$ldpath" > $out/nix-support/ldpath |
| 40 | + mkdir -p $out/lib/tmpfiles.d/ |
| 41 | + cat > $out/lib/tmpfiles.d/nix-ld.conf <<EOF |
| 42 | + L+ $ldpath - - - - $out/libexec/nix-ld |
| 43 | + EOF |
22 | 44 | ''; |
23 | 45 |
|
24 | 46 | passthru.tests = import ./nixos-test.nix { |
25 | 47 | makeTest = import (path + "/nixos/tests/make-test-python.nix"); |
26 | 48 | inherit pkgs; |
27 | 49 | }; |
28 | | - passthru.ldPath = let |
29 | | - libDir = if system == "x86_64-linux" || |
30 | | - system == "mips64-linux" || |
31 | | - system == "powerpc64le-linux" |
32 | | - then |
33 | | - "/lib64" |
34 | | - else |
35 | | - "/lib"; |
36 | | - ldName = lib.fileContents "${self}/nix-support/ld-name"; |
37 | | - in "${libDir}/${ldName}"; |
38 | | - }; |
39 | | -in self |
| 50 | + |
| 51 | + meta = with lib; { |
| 52 | + description = "Run unpatched dynamic binaries on NixOS"; |
| 53 | + homepage = "https://github.com/Mic92/nix-ld"; |
| 54 | + license = licenses.mit; |
| 55 | + maintainers = with maintainers; [ mic92 ]; |
| 56 | + platforms = platforms.unix; |
| 57 | + }; |
| 58 | + } |
0 commit comments