nix-config/config/support/secureboot.nix

36 lines
934 B
Nix
Raw Permalink 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-12-17 21:54:26 +01:00
pkgs.sbctl
2023-09-21 01:43:10 +02:00
];
age.secrets.secureboot.rekeyFile = ../../hosts/${config.node.name}/secrets/secureboot.tar.age;
system.activationScripts.securebootuntar = {
2024-12-17 21:54:26 +01:00
# TODO sbctl config file
2023-09-21 01:43:10 +02:00
text = ''
2024-12-17 21:54:26 +01:00
rm -r /var/lib/sbctl || true
mkdir -p /var/lib/sbctl
${pkgs.gnutar}/bin/tar xf ${config.age.secrets.secureboot.path} -C /var/lib/sbctl || true
chmod 700 /var/lib/sbctl
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;
2024-12-17 21:54:26 +01:00
pkiBundle = "/var/lib/sbctl/";
2023-09-21 01:43:10 +02:00
};
}