Previously, the tested plugin appeared in `rtp` under two paths:
- `/nix/store/<hash>-vimPlugins-my-plugin` from `$out`
- `/build/.local/share/nvim/site/pack/nvimRequireCheckHook/opt/testPlugin`
from `packadd testPlugin`
This was causing problems for plugins that use
`vim.api.nvim_get_runtime_file()`. For example, plugins that use
`blink.lib` to load rust modules fail the require check because
`blink.lib` uses this function to locate rust shared libraries and
raises an error when duplicate libraries are found.
The plugin is already loaded via `packadd testPlugin`, so adding `$out`
to `rtp` is unnecessary. Remove `$out` from `rtp` to avoid duplicate
runtime entries, and add a regression test to ensure the plugin appears
in `rtp` only once.
Co-authored-by: Austin Horstman <khaneliman12@gmail.com>
Installed plugin outputs can include test or metadata Lua files next to runtime modules. Skip common directory and filename patterns during automatic discovery so require checks stay focused on importable runtime modules.
Add regression coverage for ignored directories and test/meta module filenames.
Automatic discovery previously scanned src, but install hooks can move Lua modules before neovimRequireCheckHook runs. Scan out instead so require checks cover the installed plugin layout.
It is best effort since this was not part of a release yet.
I tried to do display the warning at eval time but it ended up being harder than expected.
I tried to rewrite buildVimPlugin with lib.extendMkDerivation to access the fixed point to no avail.
I think it is something worth doing but in a separate PR.
Here is a quickfix to avoid it ending up in release.
It's confusing to have a polymorphic behavior for nvimSkipModule and it
is an implementation detail.
Let's not force ourselves to keep supporting both types and just support
lists, which imply plural in nixpkgs (e.g. "lib.optional" vs "lib.optionals").
Support and showcase just the list format to avoid confusion.