From 26807cdb55ef0bb8755d47c090acff4bc46343e4 Mon Sep 17 00:00:00 2001 From: Emma Thorpe Date: Wed, 10 Jun 2026 13:51:05 +0100 Subject: [PATCH] fix(nh): drop the automatic GC timer; keep nh for rebuilds The scheduled `nh clean` only reclaimed disk and risked reaping store paths the current generation still references (notably on nix-darwin). Keep `programs.nh` (nicer rebuilds + $NH_FLAKE) but remove clean.enable; GC manually (`nh clean all` / `nix-collect-garbage -d`) when nothing important is running. The resetZcompdump activation stays as a safety net for stale completion dumps across rebuilds/manual GC. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyrathorpe/home/shell.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lyrathorpe/home/shell.nix b/lyrathorpe/home/shell.nix index 0c64ba2..83e4396 100644 --- a/lyrathorpe/home/shell.nix +++ b/lyrathorpe/home/shell.nix @@ -126,15 +126,14 @@ programs.nix-index.enable = true; programs.nix-index-database.comma.enable = true; - # Nicer nixos-rebuild/home-manager (diffs) + a weekly user-GC timer. + # Nicer nixos-rebuild/home-manager (diffs) + $NH_FLAKE. No automatic clean: + # the scheduled GC's only benefit is reclaiming disk, but it can reap store + # paths the current generation still references (notably on nix-darwin, where + # it broke completion by removing an in-use oh-my-zsh). GC manually instead: + # `nh clean all` / `nix-collect-garbage -d` when nothing important is running. programs.nh = { enable = true; flake = "$HOME/code/nixfiles"; - clean = { - enable = true; - dates = "weekly"; - extraArgs = "--keep 5 --keep-since 3d"; - }; }; programs.tmux = { @@ -260,10 +259,10 @@ services.ssh-agent.enable = lib.mkIf pkgs.stdenv.hostPlatform.isLinux true; # Drop the zsh completion dump on every activation. A stale ~/.zcompdump - # caches /nix/store paths to completion functions; once a rebuild or GC (the - # weekly nh clean) removes them, compinit fails with "_git: function - # definition file not found" for every completion. Deleting it forces a fresh - # rebuild from the current fpath on the next shell. + # caches /nix/store paths to completion functions; once a rebuild or a manual + # GC removes them, compinit fails with "_git: function definition file not + # found" for every completion. Deleting it forces a fresh rebuild from the + # current fpath on the next shell. home.activation.resetZcompdump = lib.hm.dag.entryAfter [ "writeBoundary" ] '' $DRY_RUN_CMD rm -f "$HOME"/.zcompdump* "''${XDG_CACHE_HOME:-$HOME/.cache}"/zsh/.zcompdump* 2>/dev/null || true '';