diff --git a/hosts/backwards/modules/boot/default.nix b/hosts/backwards/modules/boot/default.nix index 3098e8a..1925b73 100644 --- a/hosts/backwards/modules/boot/default.nix +++ b/hosts/backwards/modules/boot/default.nix @@ -1,5 +1,4 @@ { - inputs, lib, config, ... @@ -8,8 +7,6 @@ let configurationLimit = config.mod.gc.configurationLimit; in { - imports = [ inputs.nix-gc-env.nixosModules.default ]; - options = { mod.gc = { configurationLimit = lib.mkOption { @@ -21,12 +18,17 @@ in }; config = { - nix.gc = { - automatic = true; - dates = "weekly"; + # `nix.gc` cannot prune generations under `~/.local/state/nix/profiles` + # when run as root (NixOS/nix#8508), so home-manager generations piled up. + # `nh clean` walks those per-user profiles too. + programs.nh = { + enable = true; - # `delete_generations` added by nix-gc-env - delete_generations = "+${builtins.toString configurationLimit}"; + clean = { + enable = true; + dates = "weekly"; + extraArgs = "--keep ${builtins.toString configurationLimit}"; + }; }; boot = {