diff options
Diffstat (limited to 'system-profiles/initrd-all-crypto-modules.nix')
-rw-r--r-- | system-profiles/initrd-all-crypto-modules.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/system-profiles/initrd-all-crypto-modules.nix b/system-profiles/initrd-all-crypto-modules.nix new file mode 100644 index 00000000..ede68e9f --- /dev/null +++ b/system-profiles/initrd-all-crypto-modules.nix | |||
@@ -0,0 +1,17 @@ | |||
1 | { pkgs, config, ...}: | ||
2 | let | ||
3 | moduleList = builtins.fromJSON (builtins.readFile (pkgs.runCommandCC "crypto-modules" { buildInputs = with pkgs; [ jq ]; } '' | ||
4 | echo "[]" > $out | ||
5 | while IFS= read -r -d $'\0' file; do | ||
6 | unpacked=$(basename "''${file}" .xz) | ||
7 | xz -cd "''${file}" > "''${unpacked}" | ||
8 | |||
9 | module=$(readelf -Wp .gnu.linkonce.this_module "''${unpacked}" | sed -rn '/\[\s*[0-9]+\] /{ s/^[^]]*\]\s*//; p; q; }') | ||
10 | jq '. + [ $name ]' $out --arg name "''${module}" > out.json && mv out.json $out | ||
11 | done < <(find ${config.system.modulesTree}/lib/modules/*/kernel{,/arch/*}/crypto -iname '*.ko.xz' -print0 | sort -z) | ||
12 | '')); | ||
13 | in { | ||
14 | boot.initrd.luks.cryptoModules = moduleList ++ [ | ||
15 | "encrypted_keys" | ||
16 | ]; | ||
17 | } | ||