diff options
author | Domen Kožar <domen@dev.si> | 2019-06-22 20:10:03 +0200 |
---|---|---|
committer | Domen Kožar <domen@dev.si> | 2019-06-22 20:11:11 +0200 |
commit | 224a6562a4880195afa5c184e755b8ecaba41536 (patch) | |
tree | 216e56ac04155ede06a66192fcc3b4332602cde7 /nixos/modules/system/boot/loader/systemd-boot | |
parent | 8b7c42032ea563d545712272cfa7d10fd9b60681 (diff) |
Add configurationLimit to systemd-boot to prevent running out of disk space
Refs #23926
Diffstat (limited to 'nixos/modules/system/boot/loader/systemd-boot')
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | 4 | ||||
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index ebe37ca10a2d..f48a085ce57a 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -133,7 +133,9 @@ def get_generations(profile=None): universal_newlines=True) gen_lines = gen_list.split('\n') gen_lines.pop() - return [ (profile, int(line.split()[0])) for line in gen_lines ] + + configurationLimit = @configurationLimit@ + return [ (profile, int(line.split()[0])) for line in gen_lines ][-configurationLimit:] def remove_old_entries(gens): rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$") diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix index 3e39dc5dd396..910a602c61de 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix @@ -22,7 +22,7 @@ let editor = if cfg.editor then "True" else "False"; - inherit (cfg) consoleMode; + inherit (cfg) consoleMode configurationLimit; inherit (efi) efiSysMountPoint canTouchEfiVariables; @@ -57,6 +57,16 @@ in { ''; }; + configurationLimit = mkOption { + default = 100; + example = 120; + type = types.int; + description = '' + Maximum of configurations in boot menu. Otherwise boot partition could + run out of disk space. + ''; + }; + consoleMode = mkOption { default = "keep"; |