-
-
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
doc: Clarify that nix-shell still uses shell from host environment #8809
doc: Clarify that nix-shell still uses shell from host environment #8809
Conversation
cc375c3
to
b84a574
Compare
This comment was marked as outdated.
This comment was marked as outdated.
I think the source of my confusion is just that |
Demonstration: $ cat > shell.nix <<EOF
#!/usr/bin/env -S -u NIX_PATH nix-shell --pure
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/854fdc68881791812eddd33b2fed94b954979a8e.tar.gz") {};
in
pkgs.mkShell {
buildInputs = with pkgs; [
bash
];
}
EOF
$ nix-shell
error:
… while calling the 'import' builtin
at «string»:1:2:
1| (import <nixpkgs> {}).bashInteractive
| ^
… while calling the 'findFile' builtin
at «string»:1:9:
1| (import <nixpkgs> {}).bashInteractive
| ^
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
will use bash from your environment
[nix-shell:~/tmp]$ readlink /proc/$$/exe
/usr/bin/bash |
b84a574
to
2cf9663
Compare
2cf9663
to
f0fc678
Compare
Revisiting this, I still think that at least a small clarification would help. My confusion was that I expected the shell (Bash) executable to be obtained from the same Combined with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Demonstration:
Aghr, nix-shell
is the worst, and just about everything involved in it, inlcuding pkgs.mkShell
. The number of issues this keeps spawning is staggering. I suggest we document all of that in excruciating detail, and re-think the entire complex from scratch: NixOS/nix.dev#135 (comment) #4702 (comment)
@CyberShadow could you please fix up the details and also add your example? Then I'll merge quickly. I suggest putting the full explanation under NIX_BUILD_SHELL
and linking there from --pure
. Please check other files for how to make anchors, and test the resulting manual and man
and --help
pages that it renders correctly.
I tried to add the example but it doesn't look very good in
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much for "merge quickly"... Please excuse the long delay, other things took priority. I need a bit of clarification on what exactly you want to say, otherwise this should be good to go.
I'd say don't worry about the rendering. lowdown is janky and all of this should work differently anyway; this would another piece of motivation to change it.
Thanks @CyberShadow for your patience. Sometimes things appear in my queue at an unfortunate time and then slip through the cracks. |
Motivation
This came as a surprise to me, and even other experienced users from the Matrix channel.
Context
This is a documentation improvement which adds clarity to the semantics of the
nix-shell
command.Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.