Nix-env -e leaves executable in path

I just removed a package, ingen:

nix-env -e ingen

It supposedly succeeded:

nix-env -q | grep ingen

shows nothing.

But it remains on my path:


What to do now?

Its still in an older generation of your environment. You need to nix-collect-garbage and it will eventually get deleted.

I’m not sure I understand. It’s still in my profile’s executable path. Older generations shouldn’t affect my current one, right?

I restarted my X session and it’s still in my path.

nix-collect-garbage -d did not seem to help.

Perhaps something in your environment still depends on it?

Have you checked nix-enc --query --installed?

Good call.

That gives me the exact same as nix-env -q.

imgen is not found.

Its the same commands, haven’t seen you have it already tried.

If you try the command as root?

1 Like

I see. I thought maybe it show transitive dependencies too, or something.

That worked! Thanks!

I’m not sure I understand why though.

Because in a multi user install, everything installed by root is available for every user. It’s in the “default” profile/environment.

But I don’t recall installing it as root. It may have been installed via configuration.nix. But when I switched to unstable and switched, its version should also have been unstable – this was stable. This is what initially alerted me to the situation.

root is essentially “the system” (different user) for nix-env and nix-channels.

do: sudo nix-channels --list and it will probably be a stable release

Doh! Both unstable and stable are in there. I can see how that would allow it to persist.


This is really common when people ask, “why does this show packages twice? nix-env -qa <package>”.

The usual answer is that the nix cli is able to read from both nix-channels lists