Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default nix-path #4251

Merged
merged 1 commit into from Nov 12, 2020

Conversation

mkaito
Copy link
Contributor

@mkaito mkaito commented Nov 12, 2020

The default nix-path values for nixpkgs and root channels were incorrect, and so were not actually being added to NIX_PATH since the erroneous paths don't exist.

The test case is being able to import <nixpkgs> without an explicit NIX_PATH:

$ unset NIX_PATH

$ result/bin/nix show-config | grep nix-path
nix-path = /home/chris/.nix-defexpr/channels nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs /nix/var/nix/profiles/per-user/root/channels

$ result/bin/nix-build -E 'with import <nixpkgs> { };  hello'
this path will be fetched (0.04 MiB download, 0.20 MiB unpacked):
  /nix/store/a190zzakd2a5d91vly0d9yv85lcicwvq-hello-2.10
copying path '/nix/store/a190zzakd2a5d91vly0d9yv85lcicwvq-hello-2.10' from 'https://cache.nixos.org'...
/nix/store/a190zzakd2a5d91vly0d9yv85lcicwvq-hello-2.10

Is there anywhere I could plug in a test case for this?

The default nix-path values for nixpkgs and root channels were
incorrect.
@edolstra edolstra merged commit 258e533 into NixOS:master Nov 12, 2020
B4dM4n added a commit to B4dM4n/nix that referenced this pull request Nov 23, 2020
Since c4c3c15 (NixOS#4251) building Nix for
macOS with sandboxing fails:
```
getting status of /nix/var/nix/profiles/per-user/root/channels/nixpkgs: Operation not permitted
```

This happens, because `EvalSettings::getDefaultNixPath` tries to access
paths outside the sandbox. Since the state-dir is not required for
doc generation, it is set to the dummy folder. This needs to be done
for all nix invocations during doc generation, as
`EvalSettings::getDefaultNixPath` is called unconditionally.
B4dM4n added a commit to B4dM4n/nix that referenced this pull request Nov 23, 2020
Since c4c3c15 (NixOS#4251) building Nix for
macOS with sandboxing fails:
```
getting status of /nix/var/nix/profiles/per-user/root/channels/nixpkgs: Operation not permitted
```

This happens, because `EvalSettings::getDefaultNixPath` tries to access
paths outside the sandbox. Since the state-dir is not required for
doc generation, it is set to the dummy folder. This needs to be done
for all nix invocations during doc generation, as
`EvalSettings::getDefaultNixPath` is called unconditionally.
@B4dM4n B4dM4n mentioned this pull request Nov 23, 2020
@grahamc
Copy link
Member

grahamc commented Dec 17, 2020

I think this has broken restricted evaluation (seen in a private hydra), where Hydra is looking for root's channels even though restricted evaluation is enabled. Maybe the default path should not be added while in restricted evaluation mode?

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.

None yet

3 participants