1.6 Nix garbage collection: cleaning up the store
Lesson 6 of 68 · 4:38
Up next in 5s…
About this lesson
Everything Nix ever downloaded is still on your disk, which is why removed packages reappear instantly, and why /nix/store grows into many gigabytes. This lesson shows how Nix garbage collection works, why the first nix-collect-garbage run frees less space than you expect, and which flag makes it thorough.
In this video
- A look inside
/nix/store: measuring its size and understanding why removed packages are still there - Running
nix-collect-garbageand reading its output, and the reason a big chunk of the store survives the first run - The extra flag that also deletes old profile generations, and exactly what you give up by using it
- When not to collect garbage: the flight and train rule
- How often cleanup makes sense in practice, with real store sizes from production machines, and a pointer to automatic garbage collection with limits
After this lesson
You know why your disk fills up, and you can free space deliberately without destroying the rollbacks you still want.