Skip to content

Maintenance

Marcus Whybrow edited this page Nov 21, 2024 · 3 revisions

Reducing Disk Usage

sudo nix store gc --verbose

Will remove (garbage collect) all unused Nix packages in /nix/store.

Packages are considered active if they are part of a package linked in /var/nix/profiles. Each link constitutes a "generation" of the system which may be ran, and all packages required by a generation are considered active, and not deleted by Nix Store garbage collection.

List extant generations using ls -tl /var/nix/profiles.

Unlink any superfluous generation using, say, unlink /var/nix/profiles/system-3-link.

Run sudo nix store gc --verbose again to remove any newly inactive packages from /nix/store.

Clone this wiki locally