Added
-
nh searchaccepts--fieldsto select package fields in normal output
(#621). -
nh search prsandnh search issuesaccept--title(-t) to match the
query against titles only, instead of titles, bodies and comments
(#814). -
--elevation-strategy=empty-passwordfor remote sudo setups where PAM
authenticates out-of-band, such aspam_rsshwith a security key. nh sends
remotesudoan empty password instead of asking for one, and forwards the
local SSH agent to the target host
(#583). -
nh os dry-activatebuilds and previews activation without applying it.
Existing--drystill builds without invoking activation. -
nh os build --drynow shows what Nix would build or fetch, without building.
Previously--dryhad no effect fornh os build. Remote hosts are not
supported. -
nh os infonow distinguishes the running generation from the selected boot
profile;--jsonemits both statuses and generation metadata. -
Rollback now rejects an explicitly requested specialisation missing from the
target generation before changing the selected system profile. -
Generation discovery now accepts only exact
<profile>-<number>-linkentries;
similarly named profiles no longer leak intonh os infoor rollback. -
nh os switch/nh os bootnow accept--continue-on-activation-failure
(NH_CONTINUE_ON_ACTIVATION_FAILURE). During a switch, activation runs before
the new generation is added to the bootloader; a failed activation previously
aborted before the bootloader step, leaving nothing new to boot into. With
this flag set, nh warns and still adds the generation to the bootloader so it
is available on the next reboot. Without it, nh now emits an explicit warning
that the generation was not added to the bootloader. -
nix-installablenow provides reusable parsing and argument rendering for
flake references, Nix files, expressions, and store paths. The previous
nh-installablecrate reuses this public crate. -
nh osnow falls back to the<nixos-system>lookup-path entry, then
/etc/nixos/system.nix, then/etc/nixos/default.nix, before
<nixpkgs/nixos>when no flake or installable is configured. Explicit OS
Nix-file directories also resolvesystem.nixbeforedefault.nix
(#745). -
nh os build-image's--image-variantflag is now optional. If the flag is
not provided, the command will fallback to using
config.system.build.isoImage. -
--difftakesfullto also show packages whose version did not change, as
in--diff fullor--diff always,full. Like dix's--full, the diff now
notes how many packages it hides.
Changed
Several dependencies have been replaced with smaller, lightweight, in-house
alternatives. This is a part of an effort to make nh compile faster, and use
less space. Help text, error reports, and generated shell completions now use
the replacement libraries. Please open an issue if you notice anything out of
the ordinary!
Boolean environment variables such as NH_ASK and NH_NO_SYSTEMD_RUN now
accept 1, true, yes, 0, false and no. Other spellings like on, y
or TRUE are rejected.
nh search offlinenow reads spam-db 0.3.0 databases and searches package,
option, and library-function scopes in a single file. The previous
# spam-db-v3format is not readable by spam-db 0.3.0.--jsonis no longer forwarded tonix build. nh reads the built output path
fromnix build --print-out-paths, which--jsonwould replace. It is still
forwarded to the other Nix commands nh runs.--build-hostno longer copies the result from the build host when it is
already present in the local store.--build-hostwith a different--target-hostno longer copies the result to
localhost when the build host can copy it to the target directly. The result
is copied straight to the host that activates it, before the diff and--ask,
and a local out-link is only created when it reaches the local store.- Build progress is now shown by rom, which runs inside nh, instead of
nix-output-monitor (nom), so nh no longer needsnomat runtime.--no-nom
andNH_NOMare replaced by--no-romandNH_ROM, which behave the same.
--no-nomandNH_NOMstill work as deprecated aliases that print a warning,
and will be removed in 5.0. Unlike other boolean environment variables,
NH_ROMalso acceptsonandoff, asNH_NOMdid. rom honoursNO_COLOR
andTERM=dumb, andNH_ROM_LOG=<file>records the build log stream so it
can be replayed through rom. - Activation output is always shown, and remote activation logs each step as it
starts. Remote activation used to print nothing until it finished.
--show-activation-logsandNH_SHOW_ACTIVATION_LOGSnow do nothing and will
be removed in 5.0. Passing the flag warns that it is deprecated. - Local
nh os switch/boot/test/rollbackandnh darwin switchnow
elevate once and run all privileged steps in a singlenhprocess, instead of
elevating each step separately. Builds remain under the invoking user. Sudoers
rules that grantNOPASSWDto individual activation commands no longer apply. nh osdiffs against a--target-hostnow rundix snapshoton the target
host instead of querying its store withnix path-info --store ssh-ng://....
This requires dix >= 3.0.0 on the target host, unless both closures are
already in the local store, which is checked first.- With
--diff auto, failing diffs now only warn instead of aborting the
rebuild, both locally and remotely. --diff alwaysnow aborts on a failing diff for every command, including
nh os rollback,nh homeandnh darwin, which used to ignore it.
Fixed
-
nh searchno longer drops--limit,--channel,--platformsand
--fieldswhen they come before a subcommand, as in
nh search --limit 5 packages hello. They now apply to every subcommand that
uses them, and--limitand--fieldsare rejected for modes that don't. -
nh darwin switch --elevation-strategy nonenow sets the system profile and
activates without elevation, likenh os. It previously failed to resolve an
elevation program. -
A wrong sudo password for
--target-hostis asked for again, up to three
times, before activation starts. It used to fail activation. -
--target-hostsets the system profile withnix-env --set, as nixos-rebuild
does. The previousnix build --profilecould keep running on the target
after Ctrl+C and hold its store locks. -
Ctrl+C now cancels remote builds.
--build-hostbuilds previously ran
nix buildon the build host throughssh, where an interrupt neither
stopped nh (it waited for the build output to end) nor the remote build. nh
now runsnix build --store <build-host> --eval-store autolocally, which
copies the derivation, streams the build logs, and lets the remote daemon
cancel the build when the connection drops, like a local build. -
nh osonly infers the running system's specialisation when activating
locally, rather than applying the local machine's specialisation to a
--target-host. -
nh search packagesandnh search optionsnow query the newest
search.nixos.org index available for the channel instead of the version
bundled with nh. Outdated indices stay online, so nh previously kept showing
stale package versions after search.nixos.org moved on
(#813). The bundled version
is still used if discovery fails. -
NixOS activation now runs in a transient systemd service when systemd is
available, so switching the system does not terminate its own session. This
requires systemd 261. Activation still runs directly on systems without
systemd, or with--no-systemd-run(NH_NO_SYSTEMD_RUN). -
Specialisation activation now validates and activates the selected closure
while installing the base closure as the boot profile. -
Rollback now chooses the predecessor of the selected system profile rather
than the running system, and restores that selected profile on failure. -
Remote builds without
nomnow drain stdout and stderr while waiting,
preventing deadlocks when either pipe fills. -
Remote-only results now clear an old local out-link, preventing subsequent
activation from using an unrelated previous build. -
nh os build-vm --runnow ignores--target-host, since the VM runs locally. -
When a direct copy between remote hosts fails, the local relay now copies the
closure to the target as well as from the builder. -
Legacy image builds now use the same hostname or explicit configuration
attribute selected during image-variant validation. -
nh os build-vm --specialisationnow builds the VM derivation from the chosen
specialisation instead of the base configuration. -
nh os build-image --updatenow updates flake inputs before discovering
available image variants, rather than after validation. -
nh cleannow preserves the generation selected by each profile symlink by
default, even after a rollback when it is older than--keep-sinceand
outside the newest--keepgenerations. Previously cleanup could leave the
profile dangling (#805).nh cleanaccepts--delete-currentto let the selected profile generation
expire under the normal--keepand--keep-sincelimits. This can leave
the profile symlink dangling; without the flag, the selected generation is
kept.
-
nh darwin switchnow invokes the built configuration'sactivatescript
directly instead of requiringdarwin-rebuildin the target system
(#801). -
Image variant discovery for Nix files now escapes backslashes, double quotes,
and${in file paths before generating Nix source
(#785). -
nh os,nh home, andnh darwinnow preserve applicable Nix passthrough
arguments across evaluation, updates, remote copying and builds, and profile
installation. Multi-step and remote rebuilds no longer drop network
restrictions such as--offlineand--no-net, and flags such as
--recreate-lock-filenow affect the evaluation that selects the derivation
(#768). -
nh os switch/nh os bootno longer fail at the bootloader step with "Failed
to resolve base output path to store path" when activation applies a mount
that shadows nh's temporary build directory (for example bind-mounting over
/tmp). nh now resolves the base store path before activation runs, while the
result symlink is still visible, instead of canonicalizing it afterwards
(#659). -
Remote builds via
--build-hostno longer fail when the remote login shell is
non-POSIX (e.g. xonsh). The<drv>^*extended-output selector was quoted as
prefix'^*', which such shells pass through literally (and backslash escaping
fares no better, as\*is forwarded verbatim and rejected by Nix as an
invalid outputs specifier). nh now single-quotes the whole selector
('<drv>^*'), which survives both POSIX and non-POSIX shells. -
The
.localdomain suffix is now stripped from remote hostnames when
selecting the NixOS configuration. When building a remote target (e.g.
--target-host user@host.local),hostis now used to select the correct
nixosConfiguration, instead ofhost.local. -
nh os build-imagenow respects the attribute path supplied with a legacy Nix
file or expression installable, so commands inspect the selected configuration
instead of looking forconfigat the top level
(#778). -
nh os build-imagenow respects the--dryflag.
Removed
nh searchno longer accepts--backend-versionand
--backend-version-fallbacks, nor readsNH_SEARCH_BACKEND_VERSIONand
NH_SEARCH_BACKEND_FALLBACKS. nh discovers the newest search.nixos.org index
for the channel, and falls back to the bundled version plus two newer ones.NH_REMOTE_CLEANUPhas been removed. Interrupted remote builds are now
cancelled by the remote Nix daemon, so thepkill-based cleanup is no longer
needed.- The legacy
ssh://store scheme for--build-hostand--target-host. nh
always usesssh-ng://; anssh://prefix is treated likessh-ng://.