Cleaning the nix store: Difference between revisions
m
Category:nix
imported>Profpatsch (add a list of tools to clean the store) |
m (Category:nix) |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
Sometimes your store fills up the disk, but a simple | Sometimes your store fills up the disk, but a simple | ||
<syntaxhighlight lang=text>nix-store --gc</syntaxhighlight> | |||
does not seem to clean all that much. | |||
This usually means that you have some | This usually means that you have some old collection roots that keep old versions of nixpkgs around. | ||
There | Sometimes <code>result</code> files created by an ad-hoc <code>nix-build</code> bind a lot of resources, these can be found by running: | ||
<syntaxhighlight lang=shell> | |||
nix-store --gc --print-roots | egrep -v "^(/nix/var|/run/\w+-system|\{memory|/proc)" | |||
</syntaxhighlight> | |||
Additional Resources about cleaning up the ''nix-store'': | |||
* https://matthewrhone.dev/nixos-package-guide#cleanup-old-packages-user-wide | |||
* [[Storage optimization]] | |||
* https://old.reddit.com/r/NixOS/comments/8m1n3d/taking_out_the_trash/ | |||
There are multiple tools that can help with discovering ''gcroots'' and calculate the disk size: | |||
* https://github.com/symphorien/nix-du | * https://github.com/symphorien/nix-du | ||
Line 9: | Line 23: | ||
* 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 | ||
[[Category:nix]] |