From 698884fc5852ff648eafd1bc3b93efc03f8ea1c6 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Tue, 8 Feb 2022 12:05:04 +0100 Subject: [PATCH] [Boot] Add a configurationLimit option to limit the maximum number of boot configuration --- boot.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/boot.nix b/boot.nix index e245baf..c5626a0 100644 --- a/boot.nix +++ b/boot.nix @@ -23,6 +23,7 @@ let }; }; cfg = config.aviallon.boot; + generalCfg = config.aviallon.general; allowUnfree = (types.isType types.attrs config.nixpkgs.config) && (hasAttr "allowUnfree" config.nixpkgs.config) && (getAttr "allowUnfree" config.nixpkgs.config); @@ -51,6 +52,12 @@ in example = !default; type = types.bool; }; + configurationLimit = mkOption { + description = "Maximum number of generations in the boot menu"; + default = 30; + example = null; + type = types.int; + }; }; config = mkIf cfg.enable { @@ -74,10 +81,18 @@ in loader.grub = { version = 2; device = (if cfg.efi then "nodev" else null); - efiSupport = true; + efiSupport = cfg.efi; + configurationLimit = cfg.configurationLimit; }; - loader.systemd-boot.enable = cfg.efi && (!cfg.useGrub); + loader.systemd-boot = { + enable = cfg.efi && (!cfg.useGrub); + configurationLimit = cfg.configurationLimit; + }; + + loader.generic-extlinux-compatible = { + configurationLimit = cfg.configurationLimit; + }; loader = { efi.efiSysMountPoint = mkDefault "/boot/efi";