Open jonringer opened 3 years ago
Not sure about
provide users with packages that are the dependencies of a given derivation
The man page says "run a bash shell that provides the build environment of a derivation", so I think the current behaviour is accurate? I think this is precisely the distinction between the two use cases of "nix develop" that was pointed out here: https://github.com/NixOS/nix/issues/4609#issuecomment-898425927
Yea, but this is different from the existing nix-shell -A
behavior, which still sourced the original SHELL
[07:33:26] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ echo $SHELL
/run/current-system/sw/bin/bash
[07:33:31] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix-shell -A hello
this path will be fetched (0.69 MiB download, 0.69 MiB unpacked):
/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz
copying path '/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz' from 'https://cache.nixos.org'...
[nix-shell:/home/jon/projects/nixpkgs]$ echo $SHELL
/nix/store/39k586qrghljxiyqvv72ni5fk89vshib-bash-interactive-4.4-p23/bin/bash
[nix-shell:/home/jon/projects/nixpkgs]$ realpath /run/current-system/sw/bin/bash
/nix/store/39k586qrghljxiyqvv72ni5fk89vshib-bash-interactive-4.4-p23/bin/bash
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/confusion-about-bash-completions-flake-related/14579/7
I marked this as stale due to inactivity. → More info
This issue can be mitigated by using tools like https://github.com/numtide/devshell which avoid using stdenv
which will bring in a shell.
I don't understand what the issue is here precisely. nix develop
does give me an interactive shell:
$ nix develop
$ readlink /proc/$$/exe
/nix/store/pa9416c0x5qa4r2z3zq701qg8gyr0c73-bash-interactive-5.1-p16/bin/bash
$ echo $SHELL
/nix/store/0d3wgx8x6dxdb2cpnq105z23hah07z7l-bash-5.1-p16/bin/bash
What is SHELL
used for? I don't think the completion problems have anything to do with it, but I may be wrong.
Well, $SHELL
might be a false positive, but others were having issues with zsh
being replaced with a non-interactive bash.
The original issues is almost a year old, and may have been fixed by now
Another meaning difference between the two shells, is that nix develop
will put a non-interactive version of bash
into $PATH
.
I have been using this fix from the discourse to work around it.
fixed-by: #7010
fixed-by: #7010
Great! Btw, is there specific reason for this issue to stay open?
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nix-shell-pure-nix-command-equivalent/23058/12
Describe the bug
nix develop
is meant to be a replacment fornix-shell
, and provide users with packages that are the dependencies of a given derivation. However, it doesn't retain$SHELL
, so people get the non-interactivebash
provided by stdenv.Steps To Reproduce
Create a flake w/ devShell, run commands from above.
Expected behavior
Be able to use existing shell
nix-env --version
output