-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
nix-shell fails to parse NIX_PATH #8890
Comments
I've been seeing the exact same thing. Whats pretty interesting is that if you specify the path explicitly it works:
|
@roberth @Ericson2314 I see that you recently refactored the searchPath stuff in nix. Do you have any idea whats going on here? Also, to add to all the strangeness of this: when I build from source in a dev shell according to the instructions I found here (https://nixos.org/manual/nix/unstable/contributing/hacking.html) I get a DIFFERENT RESULT than I do when using the binary produced by nix build:
I'm kind of at a loss, and I absolutely despise working in C++, so I don't want to start trying to debug this. |
So my nix.conf looks like this:
I suspect this is why I am seeing this issue, but the thing is that im pretty sure that in --impure mode, the environment variable should be taking precedence and its not. this is weird. |
This appears to be where the environment variable is read: nix/src/libexpr/eval-settings.cc Line 48 in 4a8c9bb
but from what I can tell, this code does not seem to get executed somehow which seems really strange. |
For anyone that is seeing this after changing that in their config, you probably want something like what I did here: colonelpanic8/dotfiles@2f02f72 This is because nixpkgs seems to somewhat bizzarely do this: which ignores the cfg.nixPath value that is part of this same configuration. |
Here are some sections of documentation that would indicate that this is a genuine bug:
What should happen is arguably ambigious. In particular in the case where NIX_PATH is explicitly set to the empty string (should we clobber whatever is in nix settings in that case? |
Thanks for investigating this and for providing a workaround. It is true that I have |
This gets set automatically when you disable channels. Still, imo nixs behavior here is wrong and inconsistent with it's documentation, hence the pull request that I made. |
I was unaware of this problem when I wrote that option, |
Yes, I largely agree BUT, I do think that there is still something a bit strange about the channel disable configuration: see this comment for more details: NixOS/nixpkgs#242098 (comment) |
Think I'm also running into this. I pin down my nixpkgs rather than use channels: nix.channel.enable = false;
nix.nixPath = [("nixpkgs=" + /path/to/nixpkgs-pin)] meaning I end up with
|
I'm having this issue too, bump |
Just hit this issue, with the same reason - doing away with Nix channels. This workaround seems to be working to some extent - thanks. However, now the colon separation of nix paths doesn't apparently work, probably I'm missing something. |
Ohh never mind, it was just the |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-path-is-not-recognized/38404/6 |
This is a workaround until NixOS/nix#8890 is fixed.
Describe the bug
nix-shell isn't able to understand the
NIX_PATH
env var to locate<nixpkgs>
.Steps To Reproduce
$ NIX_PATH="nixpkgs=/nix/store/066hr2pmppfzfsn1d6lb9485hniz5p53-source" nix-shell -p nix-info --run "nix-info -m"
Fails with:
Expected behavior
I expected it to work the same way as when executed this way:
nix-shell -I nixpkgs=/nix/store/066hr2pmppfzfsn1d6lb9485hniz5p53-source -p nix-info --run "nix-info -m"
nix-env --version
outputnix-env (Nix) 2.13.5
Additional context
I think I only started seeing this after setting
nix.channel.enable = false;
in my NixOS config, but I don't think it should be relevant in any way since I'm specifying NIX_PATH explicitly in the examples above.EDIT: My
nix.conf
includesnix-path =
(blank) as a consequence of my NixOS setup. See comments below.Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: