mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 17:57:50 +00:00
[Boot] Add a configurationLimit option to limit the maximum number of boot configuration
This commit is contained in:
parent
44ba32bab0
commit
698884fc58
1 changed files with 17 additions and 2 deletions
19
boot.nix
19
boot.nix
|
|
@ -23,6 +23,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
cfg = config.aviallon.boot;
|
cfg = config.aviallon.boot;
|
||||||
|
generalCfg = config.aviallon.general;
|
||||||
allowUnfree = (types.isType types.attrs config.nixpkgs.config)
|
allowUnfree = (types.isType types.attrs config.nixpkgs.config)
|
||||||
&& (hasAttr "allowUnfree" config.nixpkgs.config)
|
&& (hasAttr "allowUnfree" config.nixpkgs.config)
|
||||||
&& (getAttr "allowUnfree" config.nixpkgs.config);
|
&& (getAttr "allowUnfree" config.nixpkgs.config);
|
||||||
|
|
@ -51,6 +52,12 @@ in
|
||||||
example = !default;
|
example = !default;
|
||||||
type = types.bool;
|
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 {
|
config = mkIf cfg.enable {
|
||||||
|
|
@ -74,10 +81,18 @@ in
|
||||||
loader.grub = {
|
loader.grub = {
|
||||||
version = 2;
|
version = 2;
|
||||||
device = (if cfg.efi then "nodev" else null);
|
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 = {
|
loader = {
|
||||||
efi.efiSysMountPoint = mkDefault "/boot/efi";
|
efi.efiSysMountPoint = mkDefault "/boot/efi";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue