nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

neovim: `withNodeJs` regressed

Open gerwin3 opened this issue 1 year ago • 7 comments

Describe the bug

Before, the withNodeJs attribute cause node to be present on path for Neovim. As of a couple of days, this does not work anymore.

It may be caused by this commit: https://github.com/NixOS/nixpkgs/commit/12dafac23cc3d9998cc5a4ce3485bad1bbba3ae9

Especially this line which is removed:

https://github.com/NixOS/nixpkgs/commit/12dafac23cc3d9998cc5a4ce3485bad1bbba3ae9#diff-7bcde5ff83173c3032fdbc3addc7386ee1b86c5d6ce90bb33b0e54a853d6af70L90

(not sure though)

Notify maintainers

@manveru @rvolosatovs @teto

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.14, NixOS, 24.11 (Vicuna), 24.11.20241014.a3c0b3b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.9`
 - nixpkgs: `/nix/store/xnjw9gmfmpppdj6bxpw6cfkspc3h6xwl-source`

Add a :+1: reaction to issues you find important.

gerwin3 avatar Oct 18 '24 09:10 gerwin3

this was not intended but a plugin should use g:node_host_prog anyway so it should not have been breaking. What/how do you use withNodeJs for ?

EDIT: and furthermore it should see https://github.com/neovim/node-client in its node env so it has always been broken ?

EDIT2: as a (temporary?) workaround, you can pass ["--suffix" "PATH" ":" (lib.makeBinPath [ nodejs ])] to wrapperArgs

teto avatar Oct 18 '24 13:10 teto

coc.nvim is not a Node.js plugin itself, but depends on node binary present in PATH. I guess coc.nvim is popular enough that users notice the breakage and think withNodeJs regressed.

coc.nvim will use Node.js binary set in g:coc_node_path or COC_NODE_PATH env variable before searching in PATH (source). I worked around the issue by adding the variable to the wrapper:

[ "--set" "COC_NODE_PATH" (lib.getExe nodejs) ]

tirr-c avatar Oct 19 '24 16:10 tirr-c

I relay on Node present in the path for few plugins. I actually use neovim with home-manager and let lazy manage the plugins, I know it's not the nix-way but it used to work fine (most of the time :D) until the latest change.

I'll try the WA and hopefully it will be resolved later.

noamsto avatar Oct 19 '24 16:10 noamsto

I need it for pyright-lsp

utkarshgupta137 avatar Oct 20 '24 12:10 utkarshgupta137

Diffing suggests that the problem is that the node directory is no longer in the path. The node executable itself is working:

--- /nix/store/8vwczaxz6zwrmz0h316p0g70bmzdvrpa-neovim-0.10.2/bin/nvim  1970-01-01 01:00:01
+++ /nix/store/x0zc9p2i8rw9md182dyna25ya6m6n73n-neovim-0.10.2/bin/nvim  1970-01-01 01:00:01
@@ -1,20 +1,5 @@
 #! /nix/store/0w0hhy7rmn5xisasdr4v4p958x114sj1-bash-5.2p32/bin/bash -e
-export NVIM_SYSTEM_RPLUGIN_MANIFEST='/nix/store/8vwczaxz6zwrmz0h316p0g70bmzdvrpa-neovim-0.10.2/rplugin.vim'
-export GEM_HOME='/nix/store/146nn1x9gnn134j6vf7d6fnjywy4w06r-neovim-ruby-env/lib/ruby/gems/3.3.0'
-PATH=${PATH:+':'$PATH':'}
-if [[ $PATH != *':''/nix/store/146nn1x9gnn134j6vf7d6fnjywy4w06r-neovim-ruby-env/bin'':'* ]]; then
-    PATH=$PATH'/nix/store/146nn1x9gnn134j6vf7d6fnjywy4w06r-neovim-ruby-env/bin'
-fi
-PATH=${PATH#':'}
-PATH=${PATH%':'}
-export PATH
-PATH=${PATH:+':'$PATH':'}
-if [[ $PATH != *':''/nix/store/fkapwdcjn9fm1n071jv7a75cw66x4wq7-nodejs-20.17.0/bin'':'* ]]; then
-    PATH=$PATH'/nix/store/fkapwdcjn9fm1n071jv7a75cw66x4wq7-nodejs-20.17.0/bin'
-fi
-PATH=${PATH#':'}
-PATH=${PATH%':'}
-export PATH
+export NVIM_SYSTEM_RPLUGIN_MANIFEST='/nix/store/x0zc9p2i8rw9md182dyna25ya6m6n73n-neovim-0.10.2/rplugin.vim'
 LUA_PATH=${LUA_PATH:+';'$LUA_PATH';'}
 LUA_PATH=${LUA_PATH/';''/nix/store/hqlfv4kzphmjq7ggis8pjjixl1dwpy9g-luajit-2.1.1713773202-env/share/lua/5.1/?/init.lua'';'/';'}
 LUA_PATH='/nix/store/hqlfv4kzphmjq7ggis8pjjixl1dwpy9g-luajit-2.1.1713773202-env/share/lua/5.1/?/init.lua'$LUA_PATH
@@ -33,4 +18,4 @@
 LUA_CPATH=${LUA_CPATH#';'}
 LUA_CPATH=${LUA_CPATH%';'}
 export LUA_CPATH
-exec -a "$0" "/nix/store/aqafkzaksbm4zk0343qi44xxlw6hvywn-neovim-unwrapped-0.10.2/bin/nvim"  --cmd "lua vim.g.node_host_prog='/nix/store/8vwczaxz6zwrmz0h316p0g70bmzdvrpa-neovim-0.10.2/bin/nvim-node';vim.g.loaded_perl_provider=0;vim.g.loaded_python_provider=0;vim.g.python3_
host_prog='/nix/store/8vwczaxz6zwrmz0h316p0g70bmzdvrpa-neovim-0.10.2/bin/nvim-python3';vim.g.ruby_host_prog='/nix/store/8vwczaxz6zwrmz0h316p0g70bmzdvrpa-neovim-0.10.2/bin/nvim-ruby'" "$@"
+exec "/nix/store/aqafkzaksbm4zk0343qi44xxlw6hvywn-neovim-unwrapped-0.10.2/bin/nvim"  --cmd "lua vim.g.node_host_prog='/nix/store/x0zc9p2i8rw9md182dyna25ya6m6n73n-neovim-0.10.2/bin/nvim-node';vim.g.loaded_perl_provider=0;vim.g.loaded_python_provider=0;vim.g.python3_host_pro
g='/nix/store/x0zc9p2i8rw9md182dyna25ya6m6n73n-neovim-0.10.2/bin/nvim-python3';vim.g.ruby_host_prog='/nix/store/x0zc9p2i8rw9md182dyna25ya6m6n73n-neovim-0.10.2/bin/nvim-ruby'" "$@"

utkarshgupta137 avatar Oct 20 '24 12:10 utkarshgupta137

I've submitted https://github.com/NixOS/nixpkgs/pull/350345 if anyone can confirm it fixes the issue

teto avatar Oct 21 '24 21:10 teto

Yep, that fixes it.

utkarshgupta137 avatar Oct 22 '24 10:10 utkarshgupta137