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.
- luarocks-nix: bumped to pass args too, `package_X = callPackage ...`.
It allows to remove the annoying `with self`.
This new version disables tests (because broken) and now emits derivation
with a callPackage in front.
- replaced X.override with lib.overrideLuarocks, it should be used
whenever buildInputs/extraVariables is changed since it impacts the
generated luarocks config.
Once structured attributes are in, it will be easier to have the
luarocks config generated by a hook and we probably will be able to
replace all overrideLuarocks by overrideAttrs.
- moved lua hooks to a specific folder as I foresee to add more
- moved generateLuarocksConfig to lib
- fix getLuaPath
- removed the useless rockspecDir
Goal is to improve separation between packages and utilities.
Can help with autocompletion/navigate nixpkgs faster.
Also it will help standardize how LUA_PATH is exported across packages,
so that one can more easily make lua changes across nixpkgs (for
instance changing where lua modules are installed).
This fixes a couple of problems:
* Lua 5.1 doesn't have SYSLIBS, so wasn't being linked with any
libraries.
* SYSLIBS doesn't include -lm, so we had to add that manually to
pkgconfig. LIBS includes -lm, so we don't need that hack any more.
This patch was removed in 34f8d7e15a ("lua: one dso patch to rule
them all"), and the reference to it in lua5_4 was removed at the time,
but it seems to have found its way back somehow (probably through a
merge?).
(cherry picked from commit 5b278213a2)
This reverts commit 537a1940e8.
This patch was deliberately removed in 34f8d7e15a ("lua: one dso
patch to rule them all"). The correct fix is to remove the reference
to it that was reintroduced, rather than re-adding the patch.
On other OSes, like NetBSD, these are part of libc. Fortunately, the
Lua Makefile already knows about this, and has a SYSLIBS variable we
can use for this.
We do this same patch in three different ways for four different Lua
versions, even though the structure of the Makefile barely changes
between releases. We can easily consolidate this by just modifying
the Makefile ourselves instead of using patches (Makefiles are very
amenable to this).
This is supposed to be automatically set by Lua's Makefile if PLAT is
set appropriately, but it was being overridden by us overridding
CFLAGS. Setting it manually was a hack. The correct thing to do was
to make sure SYSCFLAGS (where Lua's Makefile puts LUA_USE_LINUX) was
still included in our custom CFLAGS.
This creates a symlink to lua.pc for every name of the file used by Arch:
For a version of Lua (for example, 5.4) we now have:
- lib/pkgconfig/lua.pc
- lib/pkgconfig/lua-5.4.pc
- lib/pkgconfig/lua5.4.pc
- lib/pkgconfig/lua54.pc
The 672c3c1d2a refactor accidentally
dropped the last version component from the source URLs. This change
puts its back.
$ for lua in lua5_{1,2,3};do nix-instantiate --json --eval . -A $lua.src.urls | jq -r '.[]' | xargs nix-prefetch-url; done
Before this change:
lua-5.1.tar.gz 1hbjhh211p82vhwqhx4mmhmvhv56060acnka80gbmfdk3q3bjnvz (wrong hash because this is lua 5.1.0. We want 5.1.5 )
lua-5.2.tar.gz HTTP error 404
lua-5.3.tar.gz HTTP error 404
After this change:
lua-5.1.5.tar.gz 0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16
lua-5.2.4.tar.gz 0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr <-- Desired hash
lua-5.3.5.tar.gz 1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc
Converted to base16 with `nix-hash --type sha256 --to-base16`:
lua-5.1.5.tar.gz 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 <-- Desired hash
lua-5.2.4.tar.gz b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b
lua-5.3.5.tar.gz 0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac <-- Desired hash