And all the other computers? That you do not own and control?
Bash is the “guaranteed” shell on nix. It has to be the default environment to run things in. If you need something else, you probably need to build your own stdenv which provides another shell.
Not sure what you mean. I’m not asking for zsh to be the default for NixOS, I’m just asking how to make zsh the default just for me.
That is too advanced for me right now (given the time constraints that I have and needing to get to work on some deliverables that I’ve put off while learning the awesome NixOS).
It’d be neat if nixpkgs had an official option. That’s something for later though.
I’ll use chisui/zsh-nix-shell for now. I’ve opened an issue in that repo asking about support for nix run too.
Well, the main issue is that generic builder is written in bash. nix-shell, among other things, is supposed to place you into the development environment where you can call the bash functions manually. For the other use cases it is not necessary and we have several issues open about that:
Yeah, basically I only been using nix-shell so that I can spin up a new shell with certain binaries present, but not needing the nixos-specific build commands. F.e. to make shells with different versions of node or electron.
nix-shell should honor $SHELL when in interactive mode. I don’t buy that you should be forced to drop into bash as a human. I’m happy to be in a zsh inside a bash, but it seems uncouth to disregard the system shell preference. We wouldn’t drop into nano if EDITOR=vi.
Thanks, that helps a lot.
Maybe we should treat nix-shell as tool for package builder, not for package users. So maybe we need some other tools to provide virtural environment for package users?
Hello!
I also had this problem. I found that nix-shell --run $SHELL and nix develop -c $SHELL would both open ZSH as I preferred, so my solution was to make a bash alias for these two functions.
Add the following to your shell rc file:
alias nix-shell='nix-shell --run $SHELL'
nix() {
if [[ $1 == "develop" ]]; then
shift
command nix develop -c $SHELL "$@"
else
command nix "$@"
fi
}
For zsh, I added this to my zshrc file.
Now when I type nix-shell or nix develop, it opens zsh instead of bash.
Hope this helps!