Flox develop forcing bash instead of current shell?

My setup currently works like this:

bash is a login shell, it set’s few base variables and then activates flox default environment and execs into zsh that was set up by Flox. This way I can keep Flox managing zsh.

This works nicely normally but flox develop also will spawn bash and use ~/.bashrc which will exec into zsh too which will remove the develop shell.

Is shell configurable so it will use Zsh over the Bash? Bash is quite dated and not really suitable for day-to-day work. I believe this would require changing default.nix to not use mkShell or use it but spawn zsh somehow?

Seems complicated - How to Learn Nix, Part 42: Running zsh in nix-shell

I am talking to some people internally here and will respond back asap! Thanks for trying flox and for your patience!

@anon59756714 also I wanted to follow up with this info:

One of our developers wrote this blog post about 2 months ago How to setup Zsh with flox | flox:blog

I am testing out some other ideas people had and if they work well, I’ll also post those here.

1 Like

Oh, I tried shell.hook and this is nice, it works without workaround within ~/.bashrc. This way I can even add exec zsh to flox develop shell and it will start zsh without me doing it manually as with the workaround solution.

Ofc Nix purists will say that I shouldn’t exec into zsh provided by different environment (default in this case) and zsh should be packaged into develop shell itself. Realistically I want to extend my workflow with specific case per project, rather than design everything being 100% pure.

1 Like

@anon59756714 you’ll likely see the changes and improvements we’re making over time are not going to really require nix purity at every step. This will roll out over the next few weeks and months in iterations. Probably you will see some posts addressing it on the forum here soon too.

It’s very helpful to understand how you are using this, and what you are trying to do and why. Thanks so much for sharing it. If you still need help please don’t hesitate to reach out again.

1 Like

This shell.hook is fine but it breaks VSCode server as exec zsh will be mandatory and it will invalidate it’s scripting. Small addition then:

PARENT_COMMAND=$(ps -o args= $PPID)
if ! $(echo “$PARENT_COMMAND” | grep -q “wslServer.sh”); then
exec zsh
fi

1 Like