direnv
Shell extension that loads and unloads environment variables per directory from .envrc files.
HN commenters like it for loading a simple per-project .envrc into the shell12 and for pulling secrets from stores like pass, Vault or Infisical instead of keeping them in plain text.345 No complaints about direnv itself appear in these mentions;6 it suits developers who pair it with Nix, asdf or mise to keep project environments consistent.789
Why people recommend it
Secrets loading · 3
Commenters use .envrc to fetch secrets at load time from pass, Infisical or Vault rather than storing them in plain text.
“The way I solve the plain text problem is through a combination of direnv[1] and pass[2].”
“I use direnv mostly”
Show 1 more
“I use direnv (https://direnv.net/) with a hook to infisical's export command.”
Nix integration · 2
Commenters use it with Nix flakes in projects, and one notes that Zed works smoothly with Nix and direnv.
“I appreciate that Zed works smoothly with Nix and Direnv”
Simple .envrc · 1
One commenter values that it assumes nothing beyond loading a plain .envrc into the shell.
“This is why I love direnv (the tool) and just a simple .envrc (not .env).”
Team version pinning · 1
One team pairs it with asdf so everyone runs the same tool versions.
“We use direnv with asdf to ensure everyone is in the same version now.”
Caveats and dissent
No one in these comments warned against it.
Often compared with
Threads where it came up
- Once: Cache CLI commands 1 mention
- Where .env Went Wrong 1 mention
- Use Task Runners for Common Coding Tasks 1 mention
- What job interviews taught me about Kubernetes 1 mention
- Ask HN: How do small teams securely share env files? 1 mention
- Show HN: Dotenv Mask Editor: No more embarrassing screen leaks of your .env 1 mention
Data: direnv.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.
All comments 10
“I use a lot of direnv / mise.”
“This is why I love direnv (the tool) and just a simple .envrc (not .env).”
“I looked at mise to replace direnv in the few places I use it”
“We use direnv with asdf to ensure everyone is in the same version now.”
“I use direnv (https://direnv.net/) with a hook to infisical's export command.”
“I use direnv mostly”
“plugins=(direnv fzf)”
“I appreciate that Zed works smoothly with Nix and Direnv”
“in my projects (with direnv)”
“The way I solve the plain text problem is through a combination of direnv[1] and pass[2].”