git.iko.soy/typeable/nixpkgs
on master help sign in
Add configurationLimit to systemd-boot to prevent running out of disk space

Refs #23926

commit224a6562a4880195afa5c184e755b8ecaba41536 authorDomen Kožar <domen@dev.si> dateSat 22 Jun 2019, 20:10 (7 years ago) parent8b7c420
2 files changed+14−2
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py+3−1 nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix+11−1
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py+3−1
@@ -133,7 +133,9 @@ def get_generations(profile=None):
133133 universal_newlines=True)
134134 gen_lines = gen_list.split('\n')
135135 gen_lines.pop()
136− return [ (profile, int(line.split()[0])) for line in gen_lines ]
136+
137+ configurationLimit = @configurationLimit@
138+ return [ (profile, int(line.split()[0])) for line in gen_lines ][-configurationLimit:]
137139
138140def remove_old_entries(gens):
139141 rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$")
nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix+11−1
@@ -22,7 +22,7 @@ let
2222
2323 editor = if cfg.editor then "True" else "False";
2424
25− inherit (cfg) consoleMode;
25+ inherit (cfg) consoleMode configurationLimit;
2626
2727 inherit (efi) efiSysMountPoint canTouchEfiVariables;
2828
@@ -57,6 +57,16 @@ in {
5757 '';
5858 };
5959
60+ configurationLimit = mkOption {
61+ default = 100;
62+ example = 120;
63+ type = types.int;
64+ description = ''
65+ Maximum of configurations in boot menu. Otherwise boot partition could
66+ run out of disk space.
67+ '';
68+ };
69+
6070 consoleMode = mkOption {
6171 default = "keep";
6272