Package removed but binary still in path?

I have tried various config snippets to give me a functional vscode installation, but ended up with one that is missing the “git-graph” extension that I wanted to use and without the possibility to install it using the integrated installer.

Every time I changed the config and thought now maybe I have found a solution I’ve executed a nixos-rebuild switch and since I’ve been stumped that nothing seems to change ever I’ve now removed (or commented out with leading # symbol) all mentionings of vscode in my configure.nix and home.nix files and strangely, even after running nixos-rebuild switch and reopening my bash session, I still have the code binary in my path and it opens when I execute it??

Please check which code and which code | xargs realpath.

$ which code
/home/user/.nix-profile/bin/code

$ which code | xargs realpath
/nix/store/w6ckbrmjk826pg1mfi6yy8pn21ifzix7-vscode-with-extensions-1.85.2/bin/code

I’ve also rebooted a few times in between since removing all vscode mentionings

Your vscode is installed by nix profile, not in NixOS or home-manager configuration. You can try nix profile remove /nix/store/w6ckbrmjk826pg1mfi6yy8pn21ifzix7-vscode-with-extensions-1.85.2. See nix profile remove --help.

that worked, code is no longer in my path. thank you!

What is nix profile and how can I make sure I only have the software listed in my /etc/nixos config and nothing else (besides maybe stuff I manually put into path myself)?

nix profile list gives an empty response now. would this have shown vscode before removing? probably…

okey, this seems to show the only thing I had in there was vscode:

$ nix profile history
Version 1 (2024-06-03):
  vscode-with-extensions: ∅ -> 1.85.2

Version 2 (2024-06-04) <- 1:
  vscode-with-extensions: 1.85.2 -> ∅