Skip to content

Show progress while nh clean collects garbage - #209

Draft
samestep wants to merge 2 commits into
mainfrom
nh-clean-progress
Draft

Show progress while nh clean collects garbage#209
samestep wants to merge 2 commits into
mainfrom
nh-clean-progress

Conversation

@samestep

@samestep samestep commented Aug 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

samestep and others added 2 commits August 7, 2026 00:10
`nh clean` shells out to `nix store gc`, which prints one line per store
path it deletes. The new Nix CLI drops its verbosity to `lvlNotice`
whenever stderr is a terminal, so those lines are filtered out before any
logger sees them and the command sits silent for minutes:

https://github.com/NixOS/nix/blob/master/src/nix/main.cc#L435-L441

Nix has no progress reporting for garbage collection to fall back on;
`gc.cc` creates no activities at all, which NixOS/nix#15603 is open to
fix. Until then, wrap `nh` so that `clean` runs with a pipe on its
stdout, which is enough to bring the per-path lines back, and collapse
them into a single status line that redraws in place.

Everything else execs `nh` directly, as does `clean` itself when `--ask`
needs a terminal for its prompt or when stdout is redirected and the
whole log is more useful than a status line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant