right now the src is ignored in:
```
lush-nvim = buildNeovimPlugin {
pname = "lush.nvim";
version = "2022-08-09";
src = fetchFromGitHub {
owner = "rktjmp";
repo = "lush.nvim";
rev = "6b9f399245de7bea8dac2c3bf91096ffdedfcbb7";
sha256 = "0rb77rwmbm438bmbjfk5hwrrcn5sihsa1413bdpc27rw3rrn8v8z";
};
meta.homepage = "https://github.com/rktjmp/lush.nvim/";
};
```
which is very confusing. With this PR, we correctly override the src and
the version of the package. We introduce a rockspecVersion attribute of
lua package to be able to still find the rockspec when the
"version" field needs to be different than "rockspecVersion".
Fixes https://github.com/NixOS/nixpkgs/issues/193070
Basically it was hard to install both
nvim-treesitter.withPlugins (
plugins: with plugins; [
tree-sitter-c
tree-sitter-lua
tree-sitter-org-nvim
]
));
and nvim-treesitter
It also simplifies some nix code.
Stops using ex mode when running neovim for remote plugin manifest generation, since that leads to errors in more recent neovim versions with various plugins.
neovim commit that breaks this plugin generation: https://github.com/neovim/neovim/commit/64d147b
Adding "packages" to the neovim distribution triggers the wrapping of
the derivation. This is because it tries to "set packpath/rtp" in the
init.vim.
If we set these arguments via --cmd instead we can avoid to create an
init.vim, which can be useful if we want to wrap an init.lua later on
(in home-manager for instance, we dont want to generate viml code).
Also removes the support for "configure" in makeNeovimConfig and
configure.plug / configure.vam packages in the compatibility layer
'legacyWrapper'.
Neovim plugins are now more often than not written in lua.
One advantage of the lua ecosystem over vim's is the existence of
luarocks and the rockspec format, which allows to specify a package
dependencies formally.
I would like more neovim plugins to have a formal description,
"rockspec" being the current candidate.
This MR allows to use nix lua packages as neovim plugins, so as to enjoy
every benefit that rockspecs bring:
- dependdency discovery
- ability to run test suite
- luarocks versioning
- rockspec metadata
the vim update.py script will check if an attribute with the vim plugin
pname exists in lua51Packages. If it does, it uses
buildNeovimPluginFrom2Nix on it, which modifies the luarocks config to
do an almost flat install (luarocks will install the package in the lua
folder instead of share/5.1/lua etc).
It also calls toVimPlugin on it to get all the vim plugin niceties.
The list of packages that could benefit from this is available at
https://luarocks.org/labels/neovim
but I hope it grows.
Note: I DO NOT resign from nixpkgs, not at all!
However, I like a clean notification inbox and I get a lot of stuff for
packages where I'm only an end-user or don't use them anymore and thus
can't help out that much.
So please consider it a measure to reduce the mental load for me when
going through my notifications ;-)