I want to auto-unlock LUKS encrypted system drive only when the computer boots NixOS installed to an SSD. For that I need to run systemd-cryptenroll /dev/nvme0n1p1 --tpm2-device=auto --tpm2-pcrs=0+2+4+7 There appears to be no way to run custom commands when lanzaboote bootloader is installed:
|
installHook = pkgs.writeShellScript "bootinstall" '' |
|
${optionalString cfg.enrollKeys '' |
|
mkdir -p /tmp/pki |
|
cp -r ${cfg.pkiBundle}/* /tmp/pki |
|
${sbctlWithPki}/bin/sbctl enroll-keys --yes-this-might-brick-my-machine |
|
''} |
|
|
|
${cfg.package}/bin/lanzatool install \ |
|
--public-key ${cfg.publicKeyFile} \ |
|
--private-key ${cfg.privateKeyFile} \ |
|
--configuration-limit ${toString configurationLimit} \ |
|
${config.boot.loader.efi.efiSysMountPoint} \ |
|
/nix/var/nix/profiles/system-*-link |
|
''; |
Can we add custom command option to the module that runs only when bootloader is updated?
I want to auto-unlock LUKS encrypted system drive only when the computer boots NixOS installed to an SSD. For that I need to run
systemd-cryptenroll /dev/nvme0n1p1 --tpm2-device=auto --tpm2-pcrs=0+2+4+7There appears to be no way to run custom commands when lanzaboote bootloader is installed:lanzaboote/nix/modules/lanzaboote.nix
Lines 54 to 67 in 367d367
Can we add custom command option to the module that runs only when bootloader is updated?