commercialhaskell / commercialhaskell/stack
`stack gc` to shrink the space taken by ~/.stack/
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
A few days ago, I found that ~/.stack folder was about 60GiB large. Without knowing what is useful what is not, I wiped the folder. Then I was acknowleged that stack team already has the idea of garbage collection. So I digged a little.
The judging logic may not be simple, but I think the big picture could be without `stack`, just staticly analyze the folder. However considering that someone may disable the access time of the filesystem, analyzing based on it would not work.
So I think we have two ways to go. One, add a usage recording function in `stack` that write some database when accessing build-plan/cache, ghc, pkgdb, etc. So based on the database, the tool can simply see which libraries are not used for long then remove them.
Two, ignore the access time issue. This requires no change on current stack (hopefully), and the GC project can be started immediatelly. To back this up, AFAIK, `git` does not work well on filesystem without access time, either. So it is reasonable for stack to do so.
PS: [My project on this](https://github.com/Magicloud/stack/projects/1)
Contributor guide
Assessment
This issue has not been assessed yet.