When I followed the README, direnv did not get hooked into zsh because I had zsh installed at the system level, rather than enabled in my `home-manager` configuration. I suggest you make it explicit that it must be the case for the `home.nix` changes to work.
The static setup of `direnv_layout_dir` in `direnvrc` leads to the
creation of separate layout dirs and nix shell caches for each
subdirectory of a project.
Reason: When `direnvrc` is evaluated, `PWD` has the value of the calling
user's shell, instead of pointing to the project directory (the dir containing `.envrc`).
Fix this by dynamically evaluating `$PWD` in a function.
Dynamic evaluation is also required when `.envrc` includes (via `source_*`) `.envrc`
files from other projects because `$PWD` changes in this case.
Cache the computed layout paths because `shasum` is
fairly expensive (13 ms on my desktop system).
It appears that the derivations produced by nix-direnv are removed when running nix's garbage collection. Troubleshooting this issue led me to a git issue in the NixOS/nix repo [1]. Enabling both `keep-derivations` and `keep-outputs` worked for me as recommended, and now nix-direnv is working.
[1]: https://github.com/NixOS/nix/issues/2208