lorri
lorri copied to clipboard
Garbage collecting deleted projects
Feature description
Scenario:
- check out new project
- lorri installs 500 dependencies
- do some work on a project
- delete the project directory when finished with it
- 500 dependencies remain forever in the Nix store, useless and inaccessible
The only way to clean up is to delete GC roots from ~/.cache/lorri
.
It would seem to make more sense for the GC root symlink to be in the project directory, under .lorri/gcroot
or something, rather than in ~/.cache
.
Target users
Anyone who works on projects temporarily and then deletes them.
Hm, lorri doesn’t really know about projects, all we care about are nix files we evaluate. I’d rather not put files into directories we don’t control if we can help it.
We could have a lorri gc
command or similar, which checks whether the producing files still exist and deletes the gc roots if they don’t.
Yep lorri gc
would work just as well.
Though I don't really see any harm in putting files in "project" directories - in our usage of lorri, if a directory has .envrc
with $(lorri direnv)
in it, it's effectively controlled by lorri. It would seem entirely reasonable that lorri init
would create .lorri
subdirectory to store its things.
If we store a last-used timestamp, then we can have lorri gc --older-than 30d
or whatever, similar to nix-collect-garbage
.
For me it would be good enough to just have some command to clear cache.
https://docs.rs/directories/3.0.1/directories/struct.ProjectDirs.html#method.cache_dir
by the way, on mac the cache directory is $HOME/Library/Caches/com.github.target.lorri.lorri.lorri
.