From 6bbb231eb059957bcd6115f63b9e1b61d57c1fe1 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sun, 18 Aug 2024 14:44:45 +0200 Subject: [PATCH] pinwheel: Use option for `gc` configuration limit --- hosts/pinwheel/modules/boot/default.nix | 19 ++++++++++++++++--- hosts/pinwheel/modules/default.nix | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hosts/pinwheel/modules/boot/default.nix b/hosts/pinwheel/modules/boot/default.nix index 861db08..be3ea08 100644 --- a/hosts/pinwheel/modules/boot/default.nix +++ b/hosts/pinwheel/modules/boot/default.nix @@ -1,14 +1,27 @@ -{ inputs, pkgs, config, ... }: +{ inputs, pkgs, lib, config, ... }: +let + configurationLimit = config.mod.gc.configurationLimit; +in { imports = [ inputs.nix-gc-env.nixosModules.default ]; + options = { + mod.gc = { + configurationLimit = lib.mkOption { + type = lib.types.int; + default = 10; + description = "number of configuration generations to keep"; + }; + }; + }; + config = { nix.gc = { automatic = true; dates = "weekly"; # `delete_generations` added by nix-gc-env - delete_generations = "+${builtins.toString config.boot.loader.systemd-boot.configurationLimit}"; + delete_generations = "+${builtins.toString configurationLimit}"; }; boot = { @@ -23,7 +36,7 @@ loader = { systemd-boot = { enable = true; - configurationLimit = 10; + inherit configurationLimit; }; efi.canTouchEfiVariables = true; diff --git a/hosts/pinwheel/modules/default.nix b/hosts/pinwheel/modules/default.nix index 8f51d36..8bc8eff 100644 --- a/hosts/pinwheel/modules/default.nix +++ b/hosts/pinwheel/modules/default.nix @@ -8,6 +8,8 @@ in config = { mod = { + gc.configurationLimit = 10; + bluetooth.enable = true; nix-index.enable = false; greetd.enable = true;