From 448ec9307e28033231bde607026381a586e796bb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 21 Apr 2021 20:44:34 +0200 Subject: clevis: fix for use with tpm2/luks --- overlays/clevis.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 overlays/clevis.nix diff --git a/overlays/clevis.nix b/overlays/clevis.nix new file mode 100644 index 00000000..a786340c --- /dev/null +++ b/overlays/clevis.nix @@ -0,0 +1,37 @@ +final: prev: +{ + clevis = prev.clevis.overrideAttrs (oldAttrs: { + buildInputs = (oldAttrs.buildInputs or []) ++ [final.tpm2-tools]; + nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [final.makeWrapper]; + + preFixup = '' + ${oldAttrs.preFixup or ""} + + for bin in $out/bin/*; do + test -x $bin || continue + + substituteInPlace $bin \ + --replace /bin/cat ${final.coreutils}/bin/cat + + wrapProgram $bin \ + --prefix PATH : ${final.tpm2-tools}/bin \ + --prefix PATH : ${final.jose}/bin \ + --prefix PATH : ${final.libpwquality}/bin + done + ''; + }); + + tpm2-tools = prev.tpm2-tools.overrideAttrs (oldAttrs: { + fixupPhase = '' + ${oldAttrs.fixupPhase or ""} + + for wrapper in $out/bin/tpm2_*; do + symlink=.''${wrapper}-wrapped + + test -h $symlink || continue + + mv -v $symlink $wrapper + done + ''; + }); +} -- cgit v1.2.3