nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, systemd, cryptsetup }:
2
3systemd.overrideAttrs (p: {
4 version = p.version;
5 name = "systemd-cryptsetup-generator-${p.version}";
6
7 buildInputs = p.buildInputs ++ [ cryptsetup ];
8 outputs = [ "out" ];
9
10 buildPhase = ''
11 ninja systemd-cryptsetup systemd-cryptsetup-generator
12 '';
13
14 # As ninja install is not used here, the rpath needs to be manually fixed.
15 # Otherwise the resulting binary doesn't properly link against systemd-shared.so
16 postFixup = ''
17 for prog in `find $out -type f -executable`; do
18 (patchelf --print-needed $prog | grep 'libsystemd-shared-.*\.so' > /dev/null) && (
19 patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
20 ) || true
21 done
22 # test it's OK
23 "$out"/lib/systemd/systemd-cryptsetup
24 '';
25
26 installPhase = ''
27 mkdir -p $out/lib/systemd/
28 cp systemd-cryptsetup $out/lib/systemd/systemd-cryptsetup
29 cp src/shared/*.so $out/lib/systemd/
30
31 mkdir -p $out/lib/systemd/system-generators/
32 cp systemd-cryptsetup-generator $out/lib/systemd/system-generators/systemd-cryptsetup-generator
33 '';
34})