Skip to content

nixos-install: copy channels before system eval#153620

Merged
roberth merged 1 commit intoNixOS:masterfrom
pennae:fix-installer-tests
Jan 6, 2022
Merged

nixos-install: copy channels before system eval#153620
roberth merged 1 commit intoNixOS:masterfrom
pennae:fix-installer-tests

Conversation

@pennae
Copy link
Contributor

@pennae pennae commented Jan 5, 2022

since fc614c3 nixos needs access to its
own path (<nixpkgs/nixos>) to evaluate a system with documentation.
since documentation is enabled by default almost all systems need such
access, including the installer tests. nixos-install however does not
ensure that a channel exists in the target store before evaluating the
system in that store, which can lead to path is not valid errors.

not sure this is the correct fix for the problem, but it does fix the problem.

cc @ajs124

since fc614c3 nixos needs access to its
own path (<nixpkgs/nixos>) to evaluate a system with documentation.
since documentation is enabled by default almost all systems need such
access, including the installer tests. nixos-install however does not
ensure that a channel exists in the target store before evaluating the
system in that store, which can lead to `path is not valid` errors.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 5, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 5, 2022
@ajs124
Copy link
Member

ajs124 commented Jan 5, 2022

How was this working before? Or why did it not require access to that path?

@Mic92 Mic92 requested a review from infinisil January 5, 2022 19:25
@pennae
Copy link
Contributor Author

pennae commented Jan 6, 2022

not entirely sure why it worked, but guessing that previously libstore wasn't involved in handling paths. prior to the doc split all nixpkgs did was import expressions and copy paths to the store implicitly from path literals, now that source filtering is involved there are probably more checks going on.

@pennae pennae mentioned this pull request Jan 6, 2022
13 tasks
@roberth
Copy link
Member

roberth commented Jan 6, 2022

It seems that nix-build has trouble adding files from the channel because it gets a /nix/store/... path (from NIX_PATH), which doesn't exist in the /mnt store, which serves as its "evaluation store" as well. nix-env --store -p solves this by copying those files over.

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fairly minor change. nix-env -p is a reasonably simple command, so I don't expect any issues from running it earlier and the commands that now run after it either need it (nix-build) or don't interact with it (nix-env -p on another profile).
An external change is only observable when the build fails and the caller ignores the exit status, which is the obvious way to detect a failed install. We don't make any claims about the state of the system in such a case.

@roberth roberth merged commit 265fe13 into NixOS:master Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants