Add configurationLimit to systemd-boot to prevent running out of disk space
Refs #23926
This commit is contained in:
@@ -133,7 +133,9 @@ def get_generations(profile=None):
|
|||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
gen_lines = gen_list.split('\n')
|
gen_lines = gen_list.split('\n')
|
||||||
gen_lines.pop()
|
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):
|
def remove_old_entries(gens):
|
||||||
rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$")
|
rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$")
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ let
|
|||||||
|
|
||||||
editor = if cfg.editor then "True" else "False";
|
editor = if cfg.editor then "True" else "False";
|
||||||
|
|
||||||
inherit (cfg) consoleMode;
|
inherit (cfg) consoleMode configurationLimit;
|
||||||
|
|
||||||
inherit (efi) efiSysMountPoint canTouchEfiVariables;
|
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 {
|
consoleMode = mkOption {
|
||||||
default = "keep";
|
default = "keep";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user