1
0
Fork 0
nixos-config/system/boot-key.nix

20 lines
599 B
Nix
Raw Normal View History

2019-08-02 03:17:00 +00:00
{ lib, config, ... }:
let
secretsFile = "/var/lib/luks-secret/key";
secretsInitrd = "/boot/grub/secrets-initrd.gz";
2019-08-02 17:03:36 +00:00
in {
boot.initrd.luks.devices."nixos" = {
2019-08-02 03:17:00 +00:00
fallbackToPassword = true;
keyFile = secretsFile;
};
# copy the secret into the additional initramfs. `null` means same path
boot.initrd.secrets."${secretsFile}" = null;
boot.loader = {
supportsInitrdSecrets = lib.mkForce true;
grub.extraInitrd = secretsInitrd;
grub.extraPrepareConfig = ''
${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets ${secretsInitrd}
'';
};
}