summaryrefslogtreecommitdiff
path: root/overlays/clevis.nix
blob: 1cc1a717478a086b0890b7bace103ffcc2f881d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ 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
    '';
  });
}