Removing nixos packages

Remove from configuration.nix

run nix-collect-garbage.

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>