programs.zsh.enable = true; automatically sets zsh as the user's shell, overriding whatever the default is (bash likely). OTOH programs.fish.enable = true; does not. So when you open a new terminal you're faced with bash and have to open fish from bash.
@ryanorendorff
@cole-h
@rycee
@Jomik
@vdemeester
@terlar
@pvsr
@gnidorah
@hyperfekt
- system: `"x86_64-linux"`
- host os: `Linux 5.4.0-45-generic, Ubuntu, 20.04.1 LTS (Focal Fossa)`
- multi-user?: `no`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.7`
- channels(skainswo): `"home-manager, nixpkgs-20.09pre242495.3c0e3697520"`
- nixpkgs: `/home/skainswo/.nix-defexpr/channels/nixpkgs`
Is the zsh behavior desirable? I personally have multiple shells as "enabled" as fish is not compatible with the bash standards.
Hmm yeah that's a great question... I had just assumed this was the intended behavior since that was how zsh works presently. I'd be happy with any approach that is consistent across shells and lets me set my default shell.
If programs.zsh.enable = true makes zsh show up in /etc/shells then you are using the NixOS system configuration. The HM shell modules never touch /etc/shells or anything else outside $HOME.
I'm running home-manager on Ubuntu 20.04 and somehow programs.zsh.enable = true added it to my /etc/shells and set it as my default shell... I figured this was a feature and not a bug, but I guess not?
@samuela I don't know, it might be that Ubuntu comes with some chsh integration that allows zsh to do these things. As far as I know there is nothing like that in HM.
So perhaps there should be an issue for the fact that programs.zsh.enable = true _does_ set zsh as the user's default shell?
It certainly sounds like a bug. And if chsh is not involved, a considerable security issue as well.
@rycee I attempted to recreate my experience in a fresh docker container, but for better or worse I'm not able to reproduce it. I'm wondering if at some point I did a manual chsh and simply forgot about it. And I'm guessing that when I disable zsh from home-manager, the login process can't find my default shell so it just falls back to bash. I think that would explain the behavior that I'm seeing here.
Either way I'll close this issue for now since this doesn't seem like it's an issue in the first place.
Most helpful comment
Is the zsh behavior desirable? I personally have multiple shells as "enabled" as fish is not compatible with the bash standards.