nix-config/modules/optional/secureboot.nix

39 lines
992 B
Nix
Raw Normal View History

2023-09-21 01:43:10 +02:00
{
lib,
2023-09-26 22:25:58 +02:00
minimal,
pkgs,
2023-09-21 01:43:10 +02:00
config,
...
2023-09-26 22:25:58 +02:00
}:
lib.optionalAttrs (!minimal) {
2023-09-21 01:43:10 +02:00
environment.systemPackages = [
# For debugging and troubleshooting Secure Boot.
2023-09-25 21:28:30 +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;
2023-09-25 21:28:30 +02:00
# Not usable anyway
#enrollKeys = true;
2023-09-21 01:43:10 +02:00
pkiBundle = "/run/secureboot";
};
}