Removing nixos packages / nixos maintainance / nixos garbage collecting
Remove from configuration.nix
run nix-collect-garbage
.
sudo nix-collect-garbage -d
If that doesn’t cut it, you could have some application running in the background which is accessing your apps. This could be a backup manager / direnv etc…
use sudo nix-store --query --roots <nix-store-path>/<package-location>
You can find package location with ls /nix/store | rg <package-name>
If you still can’t resolve it,
You can brute force rm a package:
sudo nix-store --delete --ignore-liveness <package path>
References
https://matthewrhone.dev/nixos-package-guide#cleanup-old-packages-user-wide