Why does the garbage collector not delete the package in this scenario?
- Add a single package to configuration.nix
- Delete that single added package
- Run nix-collect-garbage -d as root
I expected that it would be deleted as it’s not part of the current generation.
The profile that’s set with
configuration.nix is owned by
root. You have to run
nix-collect-garbage -d as
sudo to get it to delete old system generations.
Seems like you don’t remove the generation. This single package is still linked to one of your old generations. Try to check with:
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
If you remove all other generations with
--delete-generations switch, you’ll probably see it’ll be the victim of new garbage collection.
I see. So there are actually three “users” with profiles - me, root, and system? And I have to refer to /nix/var/nix/profiles/system to reference the system profile. That makes sense