-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 always uses '<nixpkgs>', despite giving it a different path #459
Comments
Using a full path to
|
Here's the relevant code: if ($packages) {
push @instArgs, "--expr";
@exprs = (
'with import <nixpkgs> { }; runCommand "shell" { buildInputs = [ '
. (join " ", map { "($_)" } @exprs) . ']; } ""');
} elsif (!$fromArgs) {
@exprs = ("shell.nix") if scalar @exprs == 0 && $runEnv && -e "shell.nix";
@exprs = ("default.nix") if scalar @exprs == 0;
} And here's an excerpt from
From reading that, I would expect the above code to use "path" in place of |
You can work around it and use NIX_PATH to set it straight, |
@edwtjo Right, but that's pretty inconvenient. And, I think we should keep the semantics of
@edolstra Would you welcome a PR that resolves the disparity? |
@cstrahan I agree completely and obviously a bit tired since I failed to spot that you gave that exact example in your initial report :) |
Well, when you use |
I think I'd rather just clarify that in the docs/manpage. However, I'm more concerned about the verbosity required to do something along the lines of |
There is |
Yeah, that's not super terrible. I wasn't stating that what I wanted to do was impossible, just not very intuitive given the semantics of the other I'm not really speaking for myself, so much as the people that I'd like to get hooked on Nix. Unfortunately, my experience is that most people's brains (including those I have much respect for) turn to mush when given many similar-but-not-quite-the-same ways to do the same thing. |
Agreed, the inconsistency in interface across the various tools feels like a bit of a barrier. |
@edolstra I think it could be possible to do |
IMHO, allowing |
I marked this as stale due to inactivity. → More info |
Just ran into this issue trying to understand, what's wrong with my corrections to nixpkgs. So one additional vote to make command arguments more homogeneous. |
Instead, this works: But I think nowadays nix with flakes support offers something better. Note for newcomers, who follow More flexible approach for local projects is to import some
|
I'm curious, what's wrong with this:
|
@AleXoundOS Also, what do you mean by saying that flakes provides something better? How would you do that in the flake flavor? |
nix/src/libstore/filetransfer.hh Lines 130 to 131 in ee57f91
nix/src/libstore/filetransfer.cc Lines 38 to 39 in ee57f91
You could specify nix/src/nix-build/nix-build.cc Line 269 in f4102de
Flakes introduce
Though that also obviously removes Nixpkgs features like running setup hooks that set-up environment variables like |
Oh interesting, thanks! It would be great to document this (like |
limit depth of tutorials TOC
Note that the two paths are the same when I use
nix-shell
:Setting
$NIX_PATH
gives me the store path I would expect:Also,
nix-build
works as I would expect:nix-shell
is apparently not using the path that I'm providing. Interestingly, though, it does at least validate that the path is real:I'm also seeing the same behavior on the latest unstable Nix in Nixpkgs.
The text was updated successfully, but these errors were encountered: