nix-collect-garbageremove unreachable store pathsnix-collect-garbageageDescription
The command nix-collect-garbage performs a
garbage collection on the Nix store: any paths in the Nix store
that are garbage (not reachable from a set of root store
expressions) are deleted.
The roots of the garbage collector are the store expressions
mentioned in the files in the directory
prefix/var/nix/gcroots.
By default, the roots are all user environments in
prefix/var/nix/profiles.
You can register other store expressions as roots by writing the
full path of the store expression to an arbitrary file in the
gcroots directory (or a subdirectory
thereof).
Options /
These options cause the set of live or dead paths to be
printed, respectively, rather than performing an actual
garbage collector. They correspond exactly with the
sub-operations in nix-store
.
age
This option corresponds to the
option in nix-store .
Examples
To delete all unreachable paths, just do:
$ nix-collect-garbage