[SOLVED] Home-manager "programs" sticking around past welcome

I started using home-manager by adding some programs to the list, including neovim and borg-backup. Then I decided it would be simpler just to start out with managing my programs via home.packages, and I removed all of the programs from my home.nix.

Nevertheless, these programs are still present in my path. For example, borg is not referenced (anymore) in either home.nix or my file my-packages.nix, but it is present on the path, and querying for its referrers gives a long list of env-manifest.nix and -user-environment objects in the store:

nix-store -q --referrers $(which borg)

Questions I have:

  • Why is borg still on my path after removing it from home.nix and running home-manager switch (many times since)?
  • Is there a missing step in my workflow, which has been to edit home.nix and then run home-manager switch?

Thank you!

Totally false alarm. I misremembered that these were home-manager programs but they were actually packages installed earlier by me, listed in nix-env -q. Embarrassing for me! :slight_smile:

1 Like

Common mistake. It’s especially insidious when you use that command on NixOS, because those packages are then often taken from the user channels, which are usually not upgraded as regularly, eventually resulting in incompatibility with the host and very confusing discourse posts :wink:

nix-env should only really be used on non-NixOS systems without home-manager.