Skip to content
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 develop: Ignore stdenv's $SHELL #7010

Merged
merged 2 commits into from
Sep 24, 2022
Merged

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Sep 6, 2022

Stdenv sets this to a bash that doesn't have readline/completion support, so running nix shell inside a nix develop gives you a crippled shell. So let's just ignore the derivation's $SHELL.

This could break interactive use of build phases that use $SHELL, butthey appear to be fairly rare.

Stdenv sets this to a bash that doesn't have readline/completion
support, so running 'nix (develop|shell)' inside a 'nix develop' gives
you a crippled shell. So let's just ignore the derivation's $SHELL.

This could break interactive use of build phases that use $SHELL, but
they appear to be fairly rare.
Copy link
Member

@thufschmitt thufschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small change, but such a qol improvement :)

@@ -246,6 +246,7 @@ struct Common : InstallableCommand, MixProfile
"NIX_LOG_FD",
"NIX_REMOTE",
"PPID",
"SHELL",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead set $SHELL to the interactive bash we fetch from nixpkgs? that way most stuff will just work as expected since it will still point to bash

@ncfavier
Copy link
Member

ncfavier commented Sep 8, 2022

What does this fix exactly? The only place I see SHELL used in the Nix codebase is in nix shell.

As far as I can tell, nix develop already runs an interactive bash, so the only remaining problem is when running bash directly in a nix develop shell. I don't know if/how we can fix that.

@edolstra
Copy link
Member Author

edolstra commented Sep 8, 2022

@ncfavier It fixes this:

[eelco@localhost:~/Dev/nix]$ nix develop
[eelco@localhost:~/Dev/nix]$ nix shell
\[\][eelco@localhost:~/Dev/nix]$\[\] 

i.e. the inner shell doesn't have readline/completion support.

@ShamrockLee
Copy link
Contributor

ShamrockLee commented Sep 10, 2022

@ncfavier It would also fix the misinterpreted prompt in VSCode terminal IIUC.

@Hoverbear
Copy link
Member

I encountered this particular bug often when using starship and using nix develop then launching either vscode or neovim inside, and referring to their terminals.

Eg. (If you use `starship)

nix develop
nvim .

Then run :terminal

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants