I have the latest available node installed with home-manager. However, in order to setup github copilot, I need node <= 17. So I tried to get a shell with node 16:
⮞ node --version
v18.12.1
⮞ which node
/home/james/.nix-profile/bin/node
⮞ nix shell nixpkgs#nodejs-16_x
⮞ node --version
v18.12.1
⮞ which node
/home/james/.nix-profile/bin/node
⮞ echo $PATH
/home/james/.nix-profile/bin /home/james/.pack/bin /home/james/.npm-global/bin /nix/store/0l5yh0rdzibk8arj9c8gzy1570jkc3vf-nodejs-16.18.1/bin /home/james/.nix-profile/bin
# [... snip]
⮞ /nix/store/0l5yh0rdzibk8arj9c8gzy1570jkc3vf-nodejs-16.18.1/bin/node
Welcome to Node.js v16.18.1.
Type ".help" for more information.
It seems like the new path from the nix shell comes after my profile, so the first node found is the existing installed one, version 18.
I need neovim to see node 16, how can I get it to take priority?
What OS are you on and what configures enabling Nix in your Fish sessions (NixOS, Home Manager, Nix-Darwin, manual configuration under ~/.config/fish/conf.d/*.fish, etc.)?
Edited to add: if you have programs.fish.enable = true; written in some module system’s config file, that’s the one that’s enabling Nix support in Fish.
I think that’s from before I was using home-manager, so possibly that’s not needed if I’m using programs.fish.enable? However I thought fish didn’t read .profile, so it shouldn’t affect things.
It might be a Home Manager bug. In NixOS, we go to some lengths to make sure that Nixifying the environment happens before the sourcing of any config files. Some of that relies on looking at some files in /etc, which Home Manager doesn’t control, so idk what they’re doing instead.
I’m traveling atm but I’ll try to look at Home Manager’s fish module when I get a chance, since the answer is probably in there. (I’ll also see if I can repro with Home Manager on Ubuntu)
And yeah, Fish doesn’t read ~/.profile. If it was a fish config file in your user configuration, it’d be under ~/.config/fish, either in config.fish or the conf.d directory
It looks like I have a plugin installed, which I’d forgotten about: nix-env.fish. Possibly that and programs.fish.enable are mutually redundant? Let me figure out how to disable it.
I think that’s likely how programs.fish.enable = true; is implemented. There is some other way your environment is being Nixified as well, and I do wonder what it is.