Open MattSturgeon opened 1 month ago
My understanding is that we don't allow null in these package options because we need to be able to add something to neovim's rtp (via extraPlugins
).
I don't know if there's a way to do this by getting system installed packages from the PATH, so this may be a WONTFIX.
@traxys @GaetanLepage do you have any insight into this?
I don't know what such a feature would look like indeed, maybe we could allow strings, and this would add the corrsponding path to the rtp?
Perhaps just making the option nullable is enough, but we'd have to document clearly that users need to manually edit their rtp for the plugin to work.
I expect many users would wrongly expect to be able to just add vimPlugins.*
to their home.packages
or equivalent.
Instead they could either add to their rtp via extraConfigLuaPre
or by adding their own package to extraPlugins
... Although doing the latter would be no different from setting package
.
Enabling null should be an option to set up a conditional configuration for nixd, statix, and deadnix
such that the Language Server Protocol (LSP) only activates them if they are present on the system.
and if the user is explicitly making a package null
then they should know the workaround.
Not only for lsp packages but others too.
Most package options in nixvim are nullable already; anywhere that the program can be loaded from the PATH.
This applies to LSP language server, e.g. plugins.lsp.servers.*.package
is type null or package
.
This issue only relates to plugin's package options that aren't currently nullable, because they need to be added to the rtp to be loaded by neovim.
There's no way for neovim to "detect" plugin packages installed on the system; that's not how neovim's plugin loading works.
To install a plugin in neovim it must be explicitly added to neovim's runtimepath.
Can Nixvim expose an attribute to set runtimepath via user input? Alternatively, can it read a specific directory where users can point to their packages so that they can be considered by plugins?
When you have a plugin package, you can simply add that package to the extraPlugins
list. This will make the package available on the rtp.
If you want some other arbitrary path on the rtp, you can use extraConfigLua
like so:
extraConfigLua= ''
vim.opt.runtimepath:prepend('/some/random/path')
'';
Maybe it would be useful for extraPlugins
to also accept paths/strings? Or to have some other way to configure the rtp from a nix option. However it'd only be a thin wrapper over the lua interface and I think the use-case is fairly niche?
Discussed in https://github.com/nix-community/nixvim/discussions/1969