[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)
/nix/store/am1y43hngx26km2ysfwwi9j37misbqrn-borgbackup-1.1.17
/nix/store/grrvadhdqn8i6168rm6pmsqb33387mf4-env-manifest.nix
/nix/store/0576aq5vdn5xj39ipijgklfgvd8iapa1-user-environment
/nix/store/6rdqqalshr4z94z9vvvpz32z9ycfy69h-env-manifest.nix
...

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.