# direnv

34 Hacker News commenters recommended direnv and 3 criticized it, November 2025 to November 2026. It was recommended in 10 of 13 months. It meets the Hacker Approved badge rule.

**Verdict:** Developers recommend direnv for loading per-project environment variables and tools automatically when entering a directory, especially alongside Nix flakes. One critic reports it slows shells.

## Why people recommend it

- Works well with Nix flakes (8 comments): "the integration of flakes/devshells and direnv is great to create reproducible development environments" ([source](https://news.ycombinator.com/item?id=48721198)) "I personally use direnv with nix to have per-project dependency versions installed automatically" ([source](https://news.ycombinator.com/item?id=49218354)) "This makes the only system dependencies for a great dev environment nix and direnv." ([source](https://news.ycombinator.com/item?id=48721453))
- Loads environment automatically per directory (6 comments): "I've been personally relying more on direnv to automatically activate certain shell configurations" ([source](https://news.ycombinator.com/item?id=48575091)) "if you're using long-running shells then direnv can load and unload env vars" ([source](https://news.ycombinator.com/item?id=49338941)) "direnv is great for switching any envnvariables let given directory." ([source](https://news.ycombinator.com/item?id=46076722))
- Simple, stable, does one thing well (4 comments): "It does everything I want, nothing I don't, and has been stable for me for years." ([source](https://news.ycombinator.com/item?id=49337463)) "I show this to people as there's so little friction to using it." ([source](https://news.ycombinator.com/item?id=46718021)) "Direnv is the right way to go if you want a tool for this." ([source](https://news.ycombinator.com/item?id=49337670))
- Keeps secrets out of .envrc (3 comments): "Everything that isn't secret just lives in .envrc and gets loaded by direnv" ([source](https://news.ycombinator.com/item?id=48246685)) "This solves the problem of plain-text files" ([source](https://news.ycombinator.com/item?id=46077667)) "source_env_if_exists .envrc.local" ([source](https://news.ycombinator.com/item?id=49816292))

## Alternatives hackers recommend

- [devenv](https://hackerapproved.com/p/devenv.md): 26 recommend
- [Devbox by Jetify](https://hackerapproved.com/p/devbox.md): 10 recommend
- [Coasts](https://hackerapproved.com/p/coasts.md): 8 recommend
- [Flox](https://hackerapproved.com/p/flox.md): 7 recommend

## Cite as

Hacker Approved, "direnv", https://hackerapproved.com/p/direnv/ (counts from 1,795,640 Hacker News comments, November 2025 to November 2026).
