nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix

35 lines
1.1 KiB
Nix
Raw Normal View History

{ systemd, cryptsetup }:
2016-03-24 11:42:27 +00:00
systemd.overrideAttrs (p: {
2016-03-24 11:42:27 +00:00
version = p.version;
name = "systemd-cryptsetup-generator-${p.version}";
2016-03-24 11:42:27 +00:00
buildInputs = p.buildInputs ++ [ cryptsetup ];
2016-03-24 11:42:27 +00:00
outputs = [ "out" ];
buildPhase = ''
ninja systemd-cryptsetup systemd-cryptsetup-generator
2016-03-24 11:42:27 +00:00
'';
# As ninja install is not used here, the rpath needs to be manually fixed.
# Otherwise the resulting binary doesn't properly link against systemd-shared.so
postFixup = ''
for prog in `find $out -type f -executable`; do
(patchelf --print-needed $prog | grep 'libsystemd-shared-.*\.so' > /dev/null) && (
patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
) || true
done
# test it's OK
"$out"/lib/systemd/systemd-cryptsetup
'';
2016-03-24 11:42:27 +00:00
installPhase = ''
mkdir -p $out/lib/systemd/
cp systemd-cryptsetup $out/lib/systemd/systemd-cryptsetup
cp src/shared/*.so $out/lib/systemd/
mkdir -p $out/lib/systemd/system-generators/
cp systemd-cryptsetup-generator $out/lib/systemd/system-generators/systemd-cryptsetup-generator
2016-03-24 11:42:27 +00:00
'';
})