2019-06-16 20:59:06 +01:00
|
|
|
{ systemd, cryptsetup }:
|
2016-03-24 11:42:27 +00:00
|
|
|
|
2018-08-29 17:03:40 +01:00
|
|
|
systemd.overrideAttrs (p: {
|
2016-03-24 11:42:27 +00:00
|
|
|
version = p.version;
|
2018-05-25 10:21:07 +01:00
|
|
|
name = "systemd-cryptsetup-generator-${p.version}";
|
2016-03-24 11:42:27 +00:00
|
|
|
|
2018-08-29 17:03:40 +01:00
|
|
|
buildInputs = p.buildInputs ++ [ cryptsetup ];
|
2016-03-24 11:42:27 +00:00
|
|
|
outputs = [ "out" ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2018-02-20 11:06:55 +00:00
|
|
|
ninja systemd-cryptsetup systemd-cryptsetup-generator
|
2016-03-24 11:42:27 +00:00
|
|
|
'';
|
|
|
|
|
2018-04-11 19:51:39 +01: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
|
2019-01-26 13:12:33 +00:00
|
|
|
(patchelf --print-needed $prog | grep 'libsystemd-shared-.*\.so' > /dev/null) && (
|
2018-04-11 19:51:39 +01:00
|
|
|
patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
|
|
|
|
) || true
|
|
|
|
done
|
2019-01-26 13:12:33 +00:00
|
|
|
# test it's OK
|
|
|
|
"$out"/lib/systemd/systemd-cryptsetup
|
2018-04-11 19:51:39 +01:00
|
|
|
'';
|
|
|
|
|
2016-03-24 11:42:27 +00:00
|
|
|
installPhase = ''
|
2016-03-24 12:30:29 +00:00
|
|
|
mkdir -p $out/lib/systemd/
|
2018-02-20 11:06:55 +00:00
|
|
|
cp systemd-cryptsetup $out/lib/systemd/systemd-cryptsetup
|
|
|
|
cp src/shared/*.so $out/lib/systemd/
|
2016-03-24 14:50:39 +00:00
|
|
|
|
|
|
|
mkdir -p $out/lib/systemd/system-generators/
|
2018-02-20 11:06:55 +00:00
|
|
|
cp systemd-cryptsetup-generator $out/lib/systemd/system-generators/systemd-cryptsetup-generator
|
2016-03-24 11:42:27 +00:00
|
|
|
'';
|
|
|
|
})
|