about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix b/nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix
new file mode 100644
index 000000000000..703d13126a3f
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/cryptsetup-generator.nix
@@ -0,0 +1,33 @@
+{ 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 = ''
+    sharedLib=libsystemd-shared-${p.version}.so
+    for prog in `find $out -type f -executable`; do
+      (patchelf --print-needed $prog | grep $sharedLib > /dev/null) && (
+        patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
+      ) || true
+    done
+  '';
+
+  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
+  '';
+})