Installing Neovim remote plugins with Home Manager

Hi!

I was trying to install todoist.nvim with Home Manager recently. todoist.nvim is a Neovim remote plugin that requires Node.js environment and some node modules in order to work.

If I just use vimUtils.buildVimPlugin and add it to programs.neovim.plugins (I explained it in this post already, but creating new one because the topic seems much broader) and then generate derivation from cloned package.json I have:

  1. The vim package installed (plain VimL, no actual functionality)
  2. The remote plugin manifest generated by Home Manger (which calls :UpdateRemotePlugins internally), but incorrect one - it has only path to remote plugin, without actual functions mapped there
  3. Node modules installed, but HM and Neovim can’t see them

2nd and 3rd are tightly coupled - manifest is incorrect because when HM invokes nvim -c :UpdateRemotePlugins while knows nothing about required node modules and hence cannot generate proper mappings.

I “solved” this with horrendous hack, involving overlay of wrapNeovim that hardcoded NODE_PATH with node modules and I think I could avoid that by not delegating all the work to Home Manager, but still have several questions:

  1. Does anyone have good experience with Home Manager, Neovim and remote plugins? Is it just Node.js that doesn’t work or I missed something crucial and it works without problems
  2. Is it just the case that Node.js needs something similar to extraPythonPackages? Would PR be welcome with that?

Edit: from I could deduce from vim-plugins/overrides.nix plugins depending on external libraries are not super common in nixpkgs and probably that’s the reason why todoist.nvim wasn’t there as well.

1 Like