Native auto-activate in Flox

So: if you are using nix and use it to setup your development environments you are probably using direnv. most of nixers I know use it. you change the directory and it automagically enters your development environment. at flox we call this auto activation.

We released Flox 1.14.0 and we made this functionality native. Steve even wrote about it in detail: Flox | Auto-Activation Is Now Native in Flox.

First question I would have as a Nix user would be: “Why didn’t you just use direnv and extend like nix does it with nix-direnv?”. In short: we would love to, but our activation includes deeper features like services, layered environments, shell aliases and functions.

If nothing what you should take from this post is that you give direnv a try if using nix. and with flox this functionality comes out of the box. Do you also wish this functionality would come OOTB with nix?

4 Likes

As a nix-direnv+just+Tilt user I like having control over when my services are running other than just “is there a shell open in this directory”. Is there a way with Flox auto-activation to stop auto-start services? Just wondering.

I like that type of control myself as well. The default is that services are not auto started, except if the environment definition says otherwise (auto-start = true option). But even in then you can override that via the cli option --no-start-services (flox activate - Flox). So it is really up to you how you configure it.

2 Likes