backwards: Replace nix-gc-env with nh clean
`nix.gc` run as root cannot prune generations under `~/.local/state/nix/profiles` (NixOS/nix#8508), and `nix-gc-env` only looks in `/nix/var/nix/profiles`. Home-manager generations therefore accumulated since August 2024 and filled the disk. `nh clean all` enumerates users and walks their per-user profiles too. It replaces `nix.gc.automatic`, which cannot be enabled alongside it.
This commit is contained in:
1 parent
062321ee7f
commit
657be047ec
1 file changed
+10
-8
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
inputs,
|
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
@@ -8,8 +7,6 @@ let
|
|||||||
configurationLimit = config.mod.gc.configurationLimit;
|
configurationLimit = config.mod.gc.configurationLimit;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.nix-gc-env.nixosModules.default ];
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
mod.gc = {
|
mod.gc = {
|
||||||
configurationLimit = lib.mkOption {
|
configurationLimit = lib.mkOption {
|
||||||
@@ -21,12 +18,17 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
nix.gc = {
|
# `nix.gc` cannot prune generations under `~/.local/state/nix/profiles`
|
||||||
automatic = true;
|
# when run as root (NixOS/nix#8508), so home-manager generations piled up.
|
||||||
dates = "weekly";
|
# `nh clean` walks those per-user profiles too.
|
||||||
|
programs.nh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
# `delete_generations` added by nix-gc-env
|
clean = {
|
||||||
delete_generations = "+${builtins.toString configurationLimit}";
|
enable = true;
|
||||||
|
dates = "weekly";
|
||||||
|
extraArgs = "--keep ${builtins.toString configurationLimit}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|||||||
Reference in new issue
Block a user