A simple direnv extension to automatically load environment variables from .env files using dotenvx.
.env
mkdir -p ~/.config/direnv/lib git clone https://github.com/chenasraf/direnv-dotenvx ~/.config/direnv/lib/direnv-dotenvx
ln -s ~/.config/direnv/lib/direnv-dotenvx/use_dotenvx.sh ~/.config/direnv/lib/use_dotenvx.sh
✅ This makes the function use_dotenvx available in all .envrc files.
use_dotenvx
.envrc
In your .envrc:
use_dotenvx # loads .env or .env.default use_dotenvx dev # loads .env.dev
Then run:
direnv allow
direnv is sandboxed — only exported variables are applied to your environment. Be sure to review and trust your .env files before allowing them.
direnv
export
MIT