nix-config/modules/optional/secureboot.nix

36 lines
919 B
Nix
Raw Normal View History

2023-09-21 01:43:10 +02:00
{
pkgs,
lib,
config,
...
}: {
environment.systemPackages = [
# For debugging and troubleshooting Secure Boot.
2023-09-25 15:59:07 +02:00
pkgs.sbctl.override
{
databasePath = "/run/secureboot";
}
2023-09-21 01:43:10 +02:00
];
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
${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;
enrollKeys = true;
pkiBundle = "/run/secureboot";
};
}