Skip to content

nh os build -- --no-link creates a lot of error output #615

@ian-h-chamberlain

Description

@ian-h-chamberlain

Can behaviour can be achieved with nh os build ... -- --no-link as flags after -- are passed to nix build verbatim. I cannot recall from the top of my head whether we've put it in passthrough args but it'd still work despite not appearing in the documentation.

Originally posted by @NotAShelf in #358

Trying this spits out a bunch of error output when nh tries to diff the current system with the newly built system, I'm guessing it's looking for the symlink that wasn't generated:

$ nh os build  ~/.config -- --no-link
> Building NixOS configuration
fetching git input '<redacted>'
warning: Git tree '<redacted>' is dirty
Finished at 09:57:30 after 0s
<<< /run/current-system
>>> result
! Failed to query path "result" on current backend DBConnection(file:/nix/var/nix/db/db.sqlite) (0): failed to canonicalize path 'result'
! Failed to query path "result" on current backend DBConnection(file:/nix/var/nix/db/db.sqlite) (0): failed to canonicalize path 'result'
! Failed to query path "result" on current backend DBConnection(file:/nix/var/nix/db/db.sqlite) (0): failed to canonicalize path 'result'
! Failed to query path "result" on current backend CommandBackend (1): Unable to parse closure size from nix output
! All store backends for path "result" failed

REMOVED
...

followed by what I think is a list of every package in the current generation.

It seems to me like it might make sense to add a true nh os build --no-link flag that would skip the diff step (or use other means to find the newly build generation besides looking for ./result)?

Presumably this same flag could also apply to nh home build / nh darwin build, although I don't know if they have the same problem (will try to test on other machines when I have a chance).


Edit for clarity, adding some of the details normally present in the bug report template:

Installed via flake overlay, but also reproduces with nix run github:nix-community/nh:

DEBUG NH_VERSION=4.3.0 NH_REV=Some("0519bc2") (nh/crates/nh/src/lib.rs:44)
DEBUG cmd=Exec { nix --version } (nh/crates/nh-core/src/command.rs:773)
DEBUG Version normalized: 'nix (Lix, like Nix) 2.94.1' -> '2.94.1' (nh/crates/nh-core/src/util.rs:137)
DEBUG Using NH_FLAKE: <redacted> (nh/crates/nh-core/src/installable.rs:322)
> Building NixOS configuration

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.87.2-microsoft-standard-WSL2, NixOS, 26.05 (Yarara), 26.05.20260405.68d8aa3`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Lix, like Nix) 2.94.1
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: <redacted>
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/pv4ihl6jhj25ramq5d11xk6bic17lfxv-lix-2.94.1/share`
 - channels(root): `"nixos-24.05, nixos-wsl"`
 - nixpkgs: `/nix/store/gay80fqbpm2wakbsyd4in44gx0cwx3h5-source`

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions