Open ShamrockLee opened 2 years ago
Similar: https://github.com/NixOS/nix/issues/6091 The specific problem in your step three is described here: https://github.com/NixOS/nix/issues/6091#issuecomment-1038247010
When you ran "bash", did you intend that to be the normal bash for building, or bashInteractive?
When you ran \"bash\", did you intend that to be the normal bash for building, or bashInteractive?
I didn't even know there's a difference.
I would expect bashInteractive
, since the motivation for me to file this issue is that it breaks the VSCode terminal.
Technically, the bash provided is the one used for building the package. But for a bit of usability the shell started is bashInteractive (it turns on things that are nice when used interactively). So when you start the new shell, it’s not as usable.
This is known to happen, but not quite clear what should be done about improving the situation. Should we overwrite bash in particular? What about other shells? What about readline-wrapped variants of other tools like SQLite? Should we unset the SHELL or warn if you are descending into a potentially unusable sub shell? But then again, you may want to run build scripts or build phase that require it.
@tomberek IMO, the least-change improvement would be documenting this behavior alongside the nativeBuildInputs = [ bashInteractive ];
workaround for people to fix their VSCode terminal. Another possible inprovement would be to add flags to nix develop
(say --interactive
or --non-interactive
) to specify which kinds of Bash to use.
Looks like https://github.com/NixOS/nix/pull/7010 might be about to solve this.
I'm still running into this in spite of #6091 and #7010 being closed. In addition to problems with PS1
and arrow keys, I also get a lot of errors from my .bashrc
and related config. The superficial cause seems to be the same: bash pretends to be sh
and refuses to understand bash-specific commands. The errors are along the lines of:
bash: complete: command not found
bash: bind: command not found
My workaround: I put alias bash=/usr/bin/bash
in my shell config next to nix initialization. I think this is pretty ugly, but it works.
I'm running into this on Nix 2.15.1 on Debian trixie; I have no idea how well my workaround would work in other environments. I just started trying out Nix, so I have no idea how to do something like that alias in NixOS or elsewhere.
Describe the bug
When entering sub-shells inside
nix develop
,PS1
environment variable escape sequence got interpreted wrongly, and arrow keys doesn't work but print out^[[C^[[D^[[A^[[B
instead.This used to happen to
nix-shell
, but was fixed one or two years ago.Steps To Reproduce
Run
See the correct shell prompt
Run
See the erroneous shell prompt
Press ↑, ↓, ← and →, and see
Press ⌃ Control + C to prevent the above stuff from being executed and show a new input prompt
Type ⌃ Control + D ⌃ Control + D or run
to get back.
Expected behavior
The shell prompt and arrow keys always work correctly.
nix-env --version
output nix-env (Nix) 2.9.1Additional context
Nix info:
yes
yes
nix-env (Nix) 2.9.1
/nix/store/9m1zrzak375zkbg656zw6i54rc29xpa2-source
Text inside the above screenshot: