feat(nixos): add configurationLimit option to systemd-boot

This commit is contained in:
Mohammad Rafiq 2025-06-18 21:05:48 +08:00
parent 3b5eefe456
commit 32a4144c42
No known key found for this signature in database
2 changed files with 23 additions and 17 deletions

View file

@ -19,6 +19,12 @@ rec {
type = lib.types.attrs; type = lib.types.attrs;
default = { }; default = { };
}; };
mkIntOption =
default:
lib.mkOption {
type = lib.types.int;
inherit default;
};
mkStrOption = lib.mkOption { mkStrOption = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";

View file

@ -4,27 +4,27 @@
... ...
}: }:
let let
inherit (lib.pantheon) mkStrOption; inherit (lib.pantheon) mkIntOption mkStrOption;
cfg = config.machine.bootloader; cfg = config.machine.bootloader;
in in
{ {
options.machine.bootloader = { options.machine.bootloader = {
type = mkStrOption; type = mkStrOption;
configurationLimit = mkIntOption 5;
};
config.boot = {
initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
loader.efi.canTouchEfiVariables = true;
loader.systemd-boot = {
enable = cfg.type == "systemd-boot";
inherit (cfg) configurationLimit;
};
}; };
config = lib.mkMerge [
{
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.loader.efi.canTouchEfiVariables = true;
}
(lib.mkIf (config.machine.bootloader.type == "systemd-boot") {
boot.loader.systemd-boot.enable = true;
})
];
} }