NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.48k stars 12.98k forks source link

lua dependencies not seen for vim plugins built with buildNeovimPlugin #318925

Open teto opened 3 weeks ago

teto commented 3 weeks ago

Describe the bug

Neovim does't see the dependencies of some plugins, for instance luasnip and jsregexp and reported here https://github.com/NixOS/nixpkgs/pull/311386 and https://github.com/NixOS/nixpkgs/issues/306367 (there are other occurrences that we can link to this ticket).

Steps To Reproduce

add luasnip to neovim plugins and notice that checkhealth warns about missing jsregexp.

Expected behavior

No warning

Additional context

I solved the problem locally some time ago by creating a lua env with the closure of all vim plugins but it's not upstreamable IMO, not efficient nor clean. I started writing a test to see how it worked on master and saw jsregexp was loaded into the packpath as a lua plugin. That's because of https://github.com/NixOS/nixpkgs/pull/311386 and is a red herring. My current plan is:

  1. to customize vimUtils.packDir to aggregate the different propagated-build-inputs from the various plugins
  2. and call addToLuaPath (a variant I have that loads propagatedBuildInputs as well) on the packpath dir.
  3. wrap neovim with LUA_PATH and LUA_CPATH generated by this call.

NB: https://github.com/NixOS/nixpkgs/pull/311386 made me realize that packDir will pull transitive deps in the packdir regardless of if they are vim plugins. I think we should only include vim plugins in the closure to avoid mistakes but I will let that for the future as it could break stuff.

Notify maintainers

cc @teto

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

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

teto commented 3 weeks ago

Current attempt https://github.com/NixOS/nixpkgs/pull/319325