published
updated
This will delete all generations asides from the currently installed one
nix-env --delete-generations old
You could also do by date instead
nix-env --delete-generations 7d
Now that the generations are gone you can clean up some space from the nix store too:
nix-store --gc
In dire circumstances one can do:
sudo rm -r/run/booted-system/
sudo nix-garbage-collect -d
Sometimes result
from random nix-build
s will add up storage. Find them with:
nix-store --gc --print-roots | egrep -v "^(/nix/var|/run/\w+-system|\{memory|/proc)"