ce505a3984
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.
41 lines
1.0 KiB
Nix
41 lines
1.0 KiB
Nix
# Hooks for building lua packages.
|
|
{ lua
|
|
, lib
|
|
, makeSetupHook
|
|
, findutils
|
|
, runCommand
|
|
}:
|
|
|
|
let
|
|
callPackage = lua.pkgs.callPackage;
|
|
luaInterpreter = lua.interpreter;
|
|
in {
|
|
|
|
lua-setup-hook = LuaPathSearchPaths: LuaCPathSearchPaths:
|
|
let
|
|
hook = ./setup-hook.sh;
|
|
in runCommand "lua-setup-hook.sh" {
|
|
# hum doesn't seem to like caps !! BUG ?
|
|
luapathsearchpaths=lib.escapeShellArgs LuaPathSearchPaths;
|
|
luacpathsearchpaths=lib.escapeShellArgs LuaCPathSearchPaths;
|
|
} ''
|
|
cp ${hook} hook.sh
|
|
substituteAllInPlace hook.sh
|
|
mv hook.sh $out
|
|
'';
|
|
|
|
luarocksCheckHook = callPackage ({ luarocks }:
|
|
makeSetupHook {
|
|
name = "luarocks-check-hook";
|
|
deps = [ luarocks ];
|
|
} ./luarocks-check-hook.sh) {};
|
|
|
|
# luarocks installs data in a non-overridable location. Until a proper luarocks patch,
|
|
# we move the files around ourselves
|
|
luarocksMoveDataFolder = callPackage ({ }:
|
|
makeSetupHook {
|
|
name = "luarocks-move-rock";
|
|
deps = [ ];
|
|
} ./luarocks-move-data.sh) {};
|
|
}
|