From 5072dd354d2dd3bfead36c9269c34ed00d0f3fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Fri, 22 Dec 2023 20:32:03 +0100 Subject: [PATCH] feat: added default boot modes --- modules/boot.nix | 35 +++++++++++++++++++++++++++++++++++ modules/default.nix | 1 + 2 files changed, 36 insertions(+) create mode 100644 modules/boot.nix diff --git a/modules/boot.nix b/modules/boot.nix new file mode 100644 index 0000000..69528e1 --- /dev/null +++ b/modules/boot.nix @@ -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}; +} diff --git a/modules/default.nix b/modules/default.nix index 0b4b850..e96e8a2 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,5 +1,6 @@ { imports = [ ./interface-naming.nix + ./boot.nix ]; }