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;
default = { };
};
mkIntOption =
default:
lib.mkOption {
type = lib.types.int;
inherit default;
};
mkStrOption = lib.mkOption {
type = lib.types.str;
default = "";

View file

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