Using `nix develop` opens `bash` instead of `zsh`

So I’m using this flake specifically the command nix develop github:fuellabs/fuel.nix#sway-dev and when it opens up a new shell it chooses bash when I have zsh specified for my user in my configuration.nix. I see on the wiki that it does say a bash shell will open. Is there any way I can configure this?

I’ve found this very long thread that seems reasonable. And from reading the portion in the reference manual it seems this was developed only with the intention of supplying the user with a bash shell.

Still if anyone has any shorter or more direct route I’m all ears!

When you run that nix develop command, nix downloads this file and builds the sway-dev output, which is defined using the pkgs.mkShell function.

In the mkShell docs, a parameter shellHook is mentioned. In that hook you should be able to start zsh if it’s installed into the environment.

So you have to create your own flake.nix file and basically override that argument.

You could just download the flake I linked above, modify sway-dev to launch into zsh and then run nix develop .#sway-dev. This should work with your locally installed zsh, but ideally you would use ${pkgs.zsh} in the hook and add that to the packages argument as well.

Maybe something to try first: can you manually start zsh inside the nix shell?

1 Like

You can also try nix develop github:fuellabs/fuel.nix#sway-dev -c $SHELL to launch your shell.

or more generically:

nix develop -c $SHELL

or you can use direnv which doesn’t change your shell after creating a cache.


I ended up going with this solution and just set it under the alias swaydev