How to remove a package with nix commands?

Hello. I tried to install and remove the “hello” package following this doc page.

nix profile install nixpkgs#hello


nix profile remove packages.x86_64-linux.hello

I got

warning: 'packages.x86_64-linux.hello' does not match any packages
warning: Use 'nix profile list' to see the current profile

The only way to remove package using nix commands is using the number in the flake list. But that will be not user friendly if I’ll got more packages installed.

nix profile remove legacyPackages.x86_64-linux.hello

will do the trick.

I found this by

nix profile list

 nix profile list
0 flake:nixpkgs#legacyPackages.x86_64-linux.hello  BLAH BLAH BLAH
1 Like

It is also a solution thank you. But I will prefer using the number.

There is a bit of hiding/transformation of names when installing, perhaps this needs to be done when uninstalling too.

The tool definitely needs to tell you its ‘helping’ you, by doing some aliasing.

Could you mark it at as a solution, if i get 5 solutions a day here, the nixos foundation sends me white chocolate chip cookies.

And i’m currently all out of cookies.