Difference between revisions of "Cleaning the nix store"

From NixOS Wiki
Jump to: navigation, search
m (rollback unauthorized mass edits)
Tag: Rollback
(added nix-sweep to the list of tools)
 
Line 19: Line 19:
 
There are multiple tools that can help with discovering ''gcroots'' and calculate the disk size:
 
There are multiple tools that can help with discovering ''gcroots'' and calculate the disk size:
  
 +
* https://github.com/jzbor/nix-sweep
 
* https://github.com/symphorien/nix-du
 
* https://github.com/symphorien/nix-du
 
* https://github.com/utdemir/nix-tree
 
* https://github.com/utdemir/nix-tree
 
* https://github.com/cdepillabout/nix-query-tree-viewer
 
* https://github.com/cdepillabout/nix-query-tree-viewer
 
* https://github.com/craigmbooth/nix-visualize
 
* https://github.com/craigmbooth/nix-visualize

Latest revision as of 14:40, 25 August 2025

Sometimes your store fills up the disk, but a simple

nix-store --gc

does not seem to clean all that much.

This usually means that you have some old collection roots that keep old versions of nixpkgs around.

Sometimes result files created by an ad-hoc nix-build bind a lot of resources, these can be found by running:

  nix-store --gc --print-roots | egrep -v "^(/nix/var|/run/\w+-system|\{memory|/proc)"

Additional Resources about cleaning up the nix-store:

There are multiple tools that can help with discovering gcroots and calculate the disk size: