Using direnv with flox

This is a quick tip which seems to be working well.

If you work on a project which always needs some tools present in a specific environment you can use direnv to automatically load the right environment:

  • install direnv in your default profile (so that it’s available whenever you open a shell session)
  • create a .envrc file containing . <(flox activate -e work) where work is the environment you need
  • allow that file to be used with direnv allow

Then every time you cd into your work directory the work environment will be active.


cool tip! :dizzy: I’ve passed this on internally so we can incorporate it in our docs for others to utilise. thanks!!!