Delete old generations

and this cmd to delete old generations:
sudo nix-collect-garbage -d
Ran this cmd to list generations:
nix-env --list-generations //empty

but in the boot menu i find like 10 generations there, which is weird, when i look inside the store i can find old packages that i’ve delete and not present in my new configuration

The command to list the config generations is

nixos-rebuild list-generations

i made a mistake i just fixed it, pls read it again

To add, nix-collect-garbage doesn’t update your boot menu. To do that, re-run nixos-rebuild switch again.

2 Likes

oh I didn’t know that, but now i have another problem, i still have a package from the previous generation lives in my machine, like “input-leap” and “grapejuice”

you can find out what requires those packages with nix run nixpkgs#nix-tree.

either run it on store paths in question, or run in on system generations and search in the dependency tree for packages in question, like nix run nixpkgs#nix-tree -- /nix/var/nix/profiles/system-*