Neovim+Node.js Issue with NixOS

Hi all. I love the idea of NixOS and am looking to get it going for my workflow. I am trying to get NixOS to work with Neovim and its plugin ecosystem.
I am running NixOS 23.05beta273 (although I have tried 23.11 and had the same issue), and the related Neovim nixos package (v0.9.0).

Noevim generally works but I can not get node.js to work with neovim, which is required for some of neovim’s plugins. When I checkhealth on neovim, it says:

Node.js provider (optional)
- Disabled (g:loaded_node_provider=0).

It was a clean install so there ws no init.vim or .lua files to disable node. Node does work on the machine and is in the PATH. It is v18.16.0 from the relevant nixos pacakge. I have installed neovim multiple times on different linux distros and have never had this problem when I have installed noevim and node through traditional package managers or built from source.

I have tried two approachs based on reviewing various afticles/forums about NPM with NixOS:

  1. I have installed the node neovim module (creates neovim-node-host binary), from the relevant nixos package through the configuarion.nix. I used nodePackages_latest.neovim (also tried nodePackages.neovim) under the environment.systemPackages section. This does install the module, which I can see in the nix store file structure and I can find the bin at /run/current-system/sw/bin/neovim-node-host. I attempted to specifiy the location for node and neovim-node-host in my init.lua file with: vim.g.node_host_prog = ‘/run/current-system/sw/bin/node’ None of this worked.

  2. I have also tried to install the neovim NPM globally a nore traditional way, following this advice (Installing NPM Packages Globally in NixOS | Matthew Rhone dot Dev). It did install the neovim module, which I can see, but it did not work as neovim checkhealth continues to say that node is disabled, even if I specify the location in an init.lua file.

Looking for any advice or new ideas to try.


maybe start neovim with -V30log.txt to see what’s going on ? I dont use the node provider and without your exact config it’s hard to debug, what’s good to know is that nixpkgs sometimes wraps programs to pass some custom config so dont forget to check if the wrapping does what is intended: less $(readlink -f $(which nvim)). If not you can try variations from there.
Easiest way to enable it should be to pass withNodeJs = true; when configuring neovim.

Thank you this is very help. You were right, something in the neovim wrapper, I assume the withNodeJs ? false caused the neovim command to disable node, as I saw when I ran less $(readlink -f $(which nvim)).

However, I can’t figure out where to pass withNodeJs = true? Can I do that when I first load the package in my configuration file? I could not find clear instructions on how to do this in any of the guides and my own attempts have all resulted in errors? Would prefer something like that then building my own package.

Thanks for any further help on this.

the strange thing is that

should override the default. What does :checkhealth tell you.
You could install neovim.override { withNodeJs = true; } instead of neovim or use home-manager that has a specific module for neovim that should give you better error messages.

Thank you. I was able to get it working with the neovim.override command. I appreciate the assistance.