diff options
author | Tim Keller <tjkeller.xyz> | 2025-01-05 16:19:45 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2025-01-05 16:19:45 -0600 |
commit | 1835aa04051f2f0c41017423f2bcba6c549f26b0 (patch) | |
tree | b5f26e29032e9084b27eeb0688c7a3a9bb0df57f /modules/root/bootloader.nix | |
parent | d0faef2f53e2e5195b2acc7cc7bba898bd7cd05b (diff) | |
download | nixos-1835aa04051f2f0c41017423f2bcba6c549f26b0.tar.xz nixos-1835aa04051f2f0c41017423f2bcba6c549f26b0.zip |
overhual
Diffstat (limited to 'modules/root/bootloader.nix')
-rw-r--r-- | modules/root/bootloader.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/root/bootloader.nix b/modules/root/bootloader.nix new file mode 100644 index 0000000..0a45264 --- /dev/null +++ b/modules/root/bootloader.nix @@ -0,0 +1,43 @@ +{ lib, config, ... }: { + options = { + bootloader.loader = lib.mkOption { + type = lib.types.enum [ "grub" "systemd-boot" ]; + default = "systemd-boot"; + description = "whether to install grub or systemd-boot as the bootloader"; + }; + bootloader.mode = lib.mkOption { + type = lib.types.enum [ "efi" "bios" ]; + default = "efi"; + description = "whether to install the bootloader in efi or bios mode"; + }; + bootloader.grub = { + biosDevice = lib.mkOption { + type = lib.types.str; + description = "device to install grub on"; + }; + }; + bootloader.memtest86.enable = lib.mkEnableOption "make Memtest86+ available from the bootloader"; + }; + + config = { + boot.loader = { + grub = { + enable = config.bootloader.loader == "grub"; + efiSupport = config.bootloader.mode == "efi"; + efiInstallAsRemovable = config.bootloader.mode == "efi"; + device = if config.bootloader.mode == "bios" then config.bootloader.grub.biosDevice else "nodev"; + enableCryptodisk = true; + memtest86.enable = config.bootloader.memtest86.enable; + }; + systemd-boot = { + enable = config.bootloader.loader == "systemd-boot"; + editor = false; + memtest86.enable = config.bootloader.memtest86.enable; + }; + efi = lib.mkIf (config.bootloader.mode == "efi") { + efiSysMountPoint = lib.mkIf (config.bootloader.loader == "grub") "/boot/efi"; + canTouchEfiVariables = true; + }; + }; + }; +} |