nix-config/config/support/secureboot.nix

37 lines
1,015 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.
2024-07-26 22:12:48 +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 = ''
2023-09-27 20:49:09 +02:00
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
2023-09-21 01:43:10 +02:00
'';
2024-07-26 22:12:48 +02:00
deps = [ "agenix" ];
2023-09-21 01:43:10 +02:00
};
# 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";
};
}