1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix
Vladimír Čunát 2c226107cb
systemd-cryptsetup-generator: fixup linkage
It got broken by 74a64a8a6 #53483.
But IMO it's *this* expression that was written in a too fragile way.
2019-01-26 14:16:56 +01:00

35 lines
1.1 KiB
Nix

{ stdenv, systemd, cryptsetup }:
systemd.overrideAttrs (p: {
version = p.version;
name = "systemd-cryptsetup-generator-${p.version}";
buildInputs = p.buildInputs ++ [ cryptsetup ];
outputs = [ "out" ];
buildPhase = ''
ninja systemd-cryptsetup systemd-cryptsetup-generator
'';
# 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
'';
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
'';
})