Skip to content

Activating environments with direnv

A handy setup for environments is to activate them with direnv in a given project directory. When you enter into a directory, direnv will load the configuration present in your .envrc file. Therefore, we can tell direnv to source an environment when we enter a project directory, like this:

  1. You'll need direnv installed to your current (or default) environment.
  2. Add eval "$( flox print-dev-env; )"; to your .envrc file.

You may need to direnv allow depending on your setup.

Check out the direnv docs for more information.