Announcing NH 4.4.0

Hey all,

It’s my pleasure to announce the brand new NH 4.4.0 release, a release heavy on behavioural improvements, cleanup, CLI & ergonomic polish that we have been working on for a while. The changelog for this release is rather dense, so here’s a curated rundown of what landed since 4.3:

Highlights

  • Search gets a glow-up: nh search now uses subcommands.
    nh search packages, nh search options, and the new nh search prs,
    nh search issues, and nh search offline. Experimental offline search is
    powered by spam-db, while PR/issue search
    hits the GitHub API directly. The --default-search flag lets you pick the
    fallback mode when no subcommand is given. No more launching a browser to
    track Nixpkgs PRs!

  • More passthrough flags: --option NAME VALUE (repeatable) sets arbitrary
    Nix configuration options per-invocation, e.g. --option sandbox false.
    --override-input INPUT URL lets you tweak flake inputs without touching
    flake.nix. Both are forwarded straight to the underlying nix commands.

  • nh clean gets sharper: --keep-one keeps all active direnv gcroots
    alive regardless of --keep-since, so your projects don’t get collected just
    because you haven’t cd’d into them recently. --cross-filesystems / -x
    allows the gcroot walk to traverse mount boundaries, and --no-direnv
    preserves .direnv/ paths during nh clean all. Gcroot scanning now walks
    the full /nix/var/nix/gcroots tree recursively instead of just the auto
    subdir, and orphaned or broken gcroots are detected and cleaned up rather than
    silently ignored.

  • Remote diffing: nh os {boot,build,switch} can now compute and display
    diffs when deploying to a --target-host. No more flying blind on remote
    machines. If you find this fun, remember to give your special thanks to
    @faukah for his awesome work on Dix

  • Quality of life: Quoted attribute paths like foo."bar.baz" are now
    valid. Empty or malformed flake refs are rejected early with clear errors.
    Local flake refs are validated before Nix ever runs, and NH_FLAKE now also
    triggers feature detection checks.

Fixes

  • Performance: nh os info now batches nix path-info calls into one
    process instead of spawning one per generation, and uses an O(1) map lookup
    for closure sizes. On systems with hundreds of generations, runtime drops from
    over a minute to a few seconds.

  • Elevation: run0 elevation now uses --pty-late to avoid terminal
    ownership changes that could break subsequent commands.

  • Remote sudo: nh os switch --target-host root@host no longer wraps
    activation in sudo when the SSH user is already uid 0, matching
    nixos-rebuild and unblocking sudo shims like run0-sudo-shim.

  • Build output: --no-build-output / -Q was forwarding an unsupported
    flag; it now correctly passes --quiet to nix build.

  • Visuals: The indicatif spinner during remote closure copying renders
    properly again, and a Subprocess crate upgrade regression that garbled event
    output has been resolved.

  • Completions: Nushell completions now mark the installable argument as a
    path without breaking nh’s own flake-reference parser.

Removals

  • x86_64-darwin support has been dropped, following the same decision in
    Nixpkgs.

…and much more! Remember to take a look at our changelog if you’re interested in all the new features, fixes, changes and more.


Greatful as always to everyone who contributes. Issues, patches, discussions,
and feedback all shape what nh becomes. Your feedback drives nh to greatness,
and we appreciate all of you. I’d also like to extend my thanks to everyone who
has patiently endured the wait for 4.4 :slight_smile:

Enjoy the new NH experience, and remember to provide feedback to help us make NH
the best CLI experience for NixOS & friends!

- NotAShelf & faukah

57 Likes

nh cleanby itself is useful enough to be its own tool. Good to see more improvements to nh :slightly_smiling_face:

3 Likes