From 3c5133f721cf2887bdfe34d090fbcf1ce1cbe1c0 Mon Sep 17 00:00:00 2001 From: Maaz Khokhar Date: Sun, 5 Jul 2026 23:27:14 -0500 Subject: [PATCH] bootloader choice --- modules/core/config.nix | 20 +++++++++++++++++ modules/core/options.nix | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/modules/core/config.nix b/modules/core/config.nix index d11c79a..5e19535 100644 --- a/modules/core/config.nix +++ b/modules/core/config.nix @@ -89,5 +89,25 @@ in settings.PermitRootLogin = allowRootSSH; }; }; + + boot.loader = + if cfg.bootloader == "grub" then + { + grub = { + enable = cfg.grub.enable; + device = cfg.grub.device; + }; + + systemd-boot.enable = false; + } + else + { + systemd-boot = { + enable = cfg.systemd.enable; + efiSupport = cfg.systemd.efiSupport; + }; + + grub.enable = false; + }; }; } diff --git a/modules/core/options.nix b/modules/core/options.nix index ffb8f50..afdc92d 100644 --- a/modules/core/options.nix +++ b/modules/core/options.nix @@ -11,6 +11,54 @@ description = "The kernel of the machine"; }; + bootloader = { + type = lib.mkOption { + type = lib.types.enum [ + "grub" + "systemd" + ]; + default = "grub"; + description = "Which bootloader to use (grub or systemd-boot)"; + }; + + grub = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + device = lib.mkOption { + type = lib.types.str; + default = "nodev"; + description = "Device to install GRUB on"; + }; + }; + }; + default = { }; + description = "GRUB configuration block"; + }; + + systemd = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + efiSupport = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + }; + default = { }; + description = "systemd-boot configuration block"; + }; + }; + user = { name = lib.mkOption { type = lib.types.str;