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

Nixos does not ensure bashInteractive is installed when the default shell isn't bash #4260

Closed
thespacepanda opened this issue Sep 24, 2014 · 8 comments

Comments

@thespacepanda
Copy link

This issue presents itself if your default shell isn't bash (in my case zsh), and you attempt to use nix-shell. Nix-shell only calls bash from the user's PATH, as is explained here, and bash is expected to have readline support. However, this is not the case if bash is not the default shell - nixos simply ensures pkgs.bash is installed, not necessarily pkgs.bashInteractive. This is a problem because without readline support nix-shell does not behave as expected (notably the prompt is garbled and arrow key functionality is missing). All of these issues were fixed by me including bashInteractive in environment.systemPackages. It would be nice if nixos defaulted to keeping bashInteractive, even if it isn't the user's default shell.

@ghost
Copy link

ghost commented Nov 30, 2014

Another option is wrap nix-shell with bashInteractive.

@vcunat
Copy link
Member

vcunat commented Nov 30, 2014

Hmm, yes, I don't see why nix-shell should by run by bash from the environment; specifying an absolute-path shebang would solve this. But maybe someone knows a reason why it's better the current way.

@gurgeh
Copy link

gurgeh commented Jun 8, 2015

I use zsh and I get this (= garbled prompt and no readline) when running nix-shell too. I have not been able to fix it by installing bashInteractive. It is quite annoying.

@ghost
Copy link

ghost commented Jun 8, 2015

I haven't look into the detail, but nix-shell --command $SHELL work pretty good,
for both bash and zsh.

@gurgeh
Copy link

gurgeh commented Jun 8, 2015

@iyzsong Yes, thanks, this is what I use now. When I tried it the first time, I used --pure which worked poorly.

@Ptival
Copy link
Contributor

Ptival commented Jul 22, 2016

I have an even worse experience with all this.

The docs suggest that I can make zsh my default user shell by using the path:
/run/current-system/sw/bin/zsh

But whenever I run nix-shell from within zsh, I end up with:
/run/user/1001/nix-shell.whatever/rc: line 1: zsh: command not found

It works by adding --command zsh, and it works with ugly characters when running other commands.

@knedlsepp
Copy link
Member

Could this possibly be closed after #27493 is closed?

@domenkozar
Copy link
Member

This is now fixed in Nix 1.12, while for 1.11 there is a PR open at NixOS/nix#1483

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

No branches or pull requests

7 participants