direnv sets gcroots to a directory not in nh's regex
You can change where direnv puts its cached files. https://github.com/direnv/direnv/wiki/Customizing-cache-location
The examples I have seen end up in ${XDG_CACHE_HOME}/direnv/layouts
Can the regex nh look at be extended to cover this,
Yes, here: https://github.com/viperML/nh/blob/127a23c82aa41091e97466092d2547c08c2a9a9d/src/clean.rs#L94
Ideally we add a new CLI flag to nh clean such that the user can pass their own extra rules, e.g.
nh clean all -R "my rule" -R "my rule2"
A little more configurability would be nice, indeed. In the following debug log, we'd want to clean those within a .data path according to PRJ_DATA_HOME="${PRJ_ROOT}/.data" or PRJ_DATA_HOME="${XDG_DATA_HOME}/prj/${PRJ_ID}" (https://github.com/numtide/prj-spec/blob/main/contrib/direnv).
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/nsrg5fbni6qsmzy0yig2krir0gh4xfh8" dst="/home/dar/src/gitlab.com/dar/home-nix/.data/repo/shells/default/enter-action-17-link"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/home/dar/src/gitlab.com/dar/home-nix/.data/repo/shells/default/enter-action-17-link"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/f5hpxs6kl6whny0w8mg75326ia0mp92s" dst="/home/dar/.local/state/nix/profiles/profile-4-link"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/home/dar/.local/state/nix/profiles/profile-4-link"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/iqggyvd4vss7fry103jmwk3j8w8c3834" dst="/home/dar/.local/state/nix/profiles/home-manager-4-link"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/home/dar/.local/state/nix/profiles/home-manager-4-link"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/4qmv1kf4cha98bylbyffja46pcc6pa0h" dst="/home/dar/src/gitlab.com/dar/home-nix/.data/repo/shells/default/shell-profile-18-link"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/home/dar/src/gitlab.com/dar/home-nix/.data/repo/shells/default/shell-profile-18-link"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/q5rbiqi12j6xbpics1nv80avc0dk1lzk" dst="/nix/var/nix/profiles/system-4-link"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/nix/var/nix/profiles/system-4-link"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/qfx29j4ca5asb0qfzr4hp8ndd4gcscbb" dst="/home/dar/.local/state/home-manager/gcroots/current-home"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/home/dar/.local/state/home-manager/gcroots/current-home"
DEBUG gcroot detection: nh::clean:109: src="/nix/var/nix/gcroots/auto/mdh6ala3v43dz7hj7r27dqj4jm3jmj07" dst="/tmp/home-manager-build.L7wjEUaW2b/news.json"
DEBUG gcroot detection: nh::clean:115: dst doesn't match any gcroot regex, skipping dst="/tmp/home-manager-build.L7wjEUaW2b/news.json"