flake: set options for both grub and systemd-boot

This commit is contained in:
Charlie Root 2025-04-07 14:01:35 +02:00
commit 9e94d074ff
4 changed files with 49 additions and 25 deletions

View file

@ -27,6 +27,7 @@
modules = {
desktops.hyprland.enable = true;
system = {
boot.grub.enable = true;
impermanence.enable = false;
services = {
nextcloud.enable = true;
@ -63,7 +64,6 @@
locate.enable = true;
kanata.enable = true;
media.mpd = {
enable = true;
};

View file

@ -44,6 +44,9 @@ in {
modules = {
system = {
impermanence.enable = true;
boot = {
systemd-boot.enable = true;
};
services = {
nextcloud.enable = true;
};

View file

@ -29,6 +29,7 @@
locate.enable = true;
};
system = {
boot.grub.enable = true;
services.forgejo.enable = true;
programs = {
editors = {

View file

@ -1,10 +1,29 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.modules) mkForce;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
cfg = config.modules.system.boot;
in {
options.modules.system.boot = {
grub.enable = mkEnableOption "Grub, a bloated boot loader";
systemd-boot.enable = mkEnableOption "Poetteringboot";
};
config = {
assertions = [
{
assertion = cfg.systemd-boot.enable || cfg.grub.enable;
message = "No bootloader is enabled.";
}
{
assertion = cfg.systemd-boot.enable -> !cfg.grub.enable && cfg.grub.enable -> !cfg.systemd-boot.enable;
message = "Please enable only ONE of systemd-boot or grub.";
}
];
boot = {
initrd = {
verbose = true;
@ -13,12 +32,12 @@ in {
loader = {
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = true;
enable = cfg.systemd-boot.enable;
editor = mkForce false;
configurationLimit = 5;
};
grub = {
enable = false;
enable = cfg.grub.enable;
efiSupport = true;
device = "nodev";
configurationLimit = 5;
@ -31,4 +50,5 @@ in {
theme = "matrix";
};
};
};
}