nix-config/config/optional/secureboot.nix
Patrick fcd5a27dce
chore: new README
chore: new structure
2024-04-11 23:11:53 +02:00

40 lines
1 KiB
Nix

{
lib,
minimal,
pkgs,
config,
...
}:
lib.optionalAttrs (!minimal) {
environment.systemPackages = [
# For debugging and troubleshooting Secure Boot.
(pkgs.sbctl.override
{
databasePath = "/run/secureboot";
})
];
age.secrets.secureboot.rekeyFile = ../../hosts/${config.node.name}/secrets/secureboot.tar.age;
system.activationScripts.securebootuntar = {
text = ''
rm -r /run/secureboot || true
mkdir -p /run/secureboot
chmod 700 /run/secureboot
${pkgs.gnutar}/bin/tar xf ${config.age.secrets.secureboot.path} -C /run/secureboot || true
'';
deps = ["agenix"];
};
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
# Not usable anyway
#enrollKeys = true;
pkiBundle = "/run/secureboot";
};
}