#1604·direnv

Any way to replace mtime for hash caching?

Author: yajoCreated Jul 24, 2026Updated Jul 24, 2026
LabelsFeature

Is your feature request related to a problem? Please describe. A simple touch flake.nix makes nix-direnv violate the cache and reload. Is there a way to tell nix-direnv to only cache by file contents, ignoring mtime?

Describe the solution you'd like Somehow indicate direnv that I want to cache file contents, and not mtimes.

Describe alternatives you've considered Using lorri, but it is difficult and has its own bugs.

Additional context I use Git worktrees, more specifically with wt, which allows for very quick and smart reflinking git-untracked files when creating a new worktree.

Therefore, the .direnv folder, which is often git-ignored, gets copied. And all inputs and caches are the same.

However, when entering the direnv of this new worktree, nix-direnv still has to reload because of newer mtimes.

Coming from https://github.com/nix-community/nix-direnv/issues/771#issuecomment-5058729797