Broken symbolic links in `/nix/var/nix/gcroots/per-user/` are not garbage collected
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.7k
- Forks
- 2k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 80
Description
Describe the bug
Broken symbolic links in /nix/var/nix/gcroots/per-user/ are not garbage collected. However, broken symbolic links in /nix/var/nix/gcroots/auto/ are garbage collected. This behavior is not consistent, but it might be intentional. Is that so? If so, why? If not, can we also collect broken symbolic links in the per-user directory?
Steps To Reproduce
The problem arose due to excessive usage of nix-direnv, which creates symbolic links in the per-user category. When nix-direnv profiles are changed, new links are created, and the old ones become broken.
Expected behavior
I do not know what the expected behavior is in general. In my use case, I expected the garbage collector to also collect the symbolic links in the per-user directory.
nix-env --version output
nix-env (Nix) 2.11.0
Additional context
See a corresponding issue at nix-direnv: https://github.com/nix-community/nix-direnv/issues/242.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the broken-link scenario described for /nix/var/nix/gcroots/per-user/ and compare it with garbage collection under /nix/var/nix/gcroots/auto/. Review the linked nix-direnv issue for context; done means the intended behavior is established and the per-user links are either handled consistently or the difference is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100