nix-collect-garbage

Delete unused and unreachable nix store paths. Generations can be listed using nix-env --list-generations. More information: https://nixos.org/manual/nix/stable/command-ref/nix-collect-garbage.html.

sudo nix-collect-garbage {{[-d|--delete-old]}}

sudo nix-collect-garbage {{[-d|--delete-old]}} --dry-run

sudo nix-collect-garbage --delete-older-than 30d