You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All options not listed here are passed to nix-store --realise, except for --arg and --attr / -A which are passed to nix-instantiate.
In fact, nix-shell tries to use everything as a path that doesn't begin with --. Observe:
$ nix-shell --add-root ./result --indirect
error: getting status of `./result': No such file or directory
(I've elided the full path to ./ above for clarity.)
OK, so with Nix 1.6, I would work around this by putting quotes around "--add-root ./result". Let's try that:
$ nix-shell "--add-root ./result" --indirect
error: unknown flag `--add-root result'
Try `nix-store --help' for more information.
/run/current-system/sw/bin/nix-shell: failed to build all dependencies
Alright, that's no good with Nix 1.7. The problem to begin with was that nix-shell thought result was the path to a Nix expression, and not an option for nix-store. So, I'll give it the path to an expression explicitly:
$ nix-shell default.nix --add-root ./result --indirect
error: path `./--indirect' is not a valid garbage collector root; it's not in the directory `/nix/var/nix/gcroots'
/run/current-system/sw/bin/nix-shell: failed to build all dependencies
What? Oh, ./result isn't being passed to nix-store after --add-root, even though nix-shell isn't using it as a path.
I need a way to pass arguments to nix-store through nix-shell. I suggest either or both of the following
Have nix-shell take only the first path on the command line as the path to a Nix expression. Leave the rest of the command line alone. Then, my third command above would work.
Use -- alone to terminate option parsing by nix-shell and pass everything thereafter directly to nix-store. Then I could use, e.g.,
nix-shell -- --add-root ./result --indirect
The text was updated successfully, but these errors were encountered:
ttuegel
changed the title
nix-shell mangles options sent to nix-build
nix-shell mangles options sent to nix-store
Apr 18, 2014
man nix-shell
says:In fact, nix-shell tries to use everything as a path that doesn't begin with
--
. Observe:(I've elided the full path to
./
above for clarity.)OK, so with Nix 1.6, I would work around this by putting quotes around
"--add-root ./result"
. Let's try that:Alright, that's no good with Nix 1.7. The problem to begin with was that nix-shell thought
result
was the path to a Nix expression, and not an option for nix-store. So, I'll give it the path to an expression explicitly:What? Oh,
./result
isn't being passed tonix-store
after--add-root
, even though nix-shell isn't using it as a path.I need a way to pass arguments to nix-store through nix-shell. I suggest either or both of the following
--
alone to terminate option parsing by nix-shell and pass everything thereafter directly to nix-store. Then I could use, e.g.,The text was updated successfully, but these errors were encountered: