50 lines
1.1 KiB
Nix
Executable File
50 lines
1.1 KiB
Nix
Executable File
# Bootloader: lanzaboote (Secure Boot) or plain systemd-boot, plus kernel.
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.boot;
|
|
in
|
|
{
|
|
options.my.boot.secureBoot.enable = lib.mkEnableOption ''
|
|
Secure Boot through lanzaboote. Keys live in /var/lib/sbctl (create them
|
|
with `sbctl create-keys` before the first boot). When disabled the system
|
|
uses plain systemd-boot
|
|
'';
|
|
|
|
config = lib.mkMerge [
|
|
{
|
|
boot = {
|
|
loader.efi.canTouchEfiVariables = true;
|
|
initrd.systemd.enable = true;
|
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
|
};
|
|
}
|
|
|
|
(lib.mkIf cfg.secureBoot.enable {
|
|
boot = {
|
|
lanzaboote = {
|
|
enable = true;
|
|
pkiBundle = "/var/lib/sbctl";
|
|
configurationLimit = 10;
|
|
};
|
|
# lanzaboote installs the boot entries itself.
|
|
loader.systemd-boot.enable = lib.mkForce false;
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.sbctl ];
|
|
})
|
|
|
|
(lib.mkIf (!cfg.secureBoot.enable) {
|
|
boot.loader.systemd-boot = {
|
|
enable = true;
|
|
configurationLimit = 10;
|
|
editor = false;
|
|
};
|
|
})
|
|
];
|
|
}
|