feat: added default boot modes

This commit is contained in:
Patrick Großmann 2023-12-22 20:32:03 +01:00
parent 073a8ae3b3
commit 5072dd354d
No known key found for this signature in database
GPG key ID: 451F95EFB8BECD0F
2 changed files with 36 additions and 0 deletions

35
modules/boot.nix Normal file
View file

@ -0,0 +1,35 @@
{
config,
lib,
...
}: {
option.boot.mode = lib.mkOption {
description = "Enable recommended Options for different boot modes";
type = lib.types.nullOr (lib.types.enum ["bios" "efi" "secureboot"]);
default = null;
};
config = let
bios-conf = {
boot.loader.grub = {
enable = true;
efiSupport = false;
configurationLimit = 32;
};
};
efi-conf = {
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot.enable = true;
systemd-boot.configurationLimit = 32;
efi.canTouchEfiVariables = true;
};
};
in
lib.mkIf (config.boot.mode != null)
{
"efi" = efi-conf;
"bios" = bios-conf;
"secureboot" = throw "not yet implemented";
}
.${config.boot.mode};
}