
Trying to use: `plugin = pkgs.neovimUtils.buildNeovimPlugin { luaAttr = "rocks-nvim"; };` fails with: ``` error: attribute 'version' missing at /nix/store/0ww4wsg5q5hmnzv06a0k1q32jc49y7gi-source/pkgs/applications/editors/neovim/build-neovim-plugin.nix:28:19: 27| })).overrideAttrs (drv: { 28| version = attrs.version; | ^ 29| rockspecVersion = drv.rockspecVersion; ``` This PR fixes it.
39 lines
1.0 KiB
Nix
39 lines
1.0 KiB
Nix
{ lib
|
|
, stdenv
|
|
, lua
|
|
, toVimPlugin
|
|
}:
|
|
let
|
|
# sanitizeDerivationName
|
|
normalizeName = lib.replaceStrings [ "." ] [ "-" ];
|
|
in
|
|
|
|
# function to create vim plugin from lua packages that are already packaged in
|
|
# luaPackages
|
|
{
|
|
# the lua attribute name that matches this vim plugin. Both should be equal
|
|
# in the majority of cases but we make it possible to have different attribute names
|
|
luaAttr ? (normalizeName attrs.pname)
|
|
, ...
|
|
}@attrs:
|
|
let
|
|
originalLuaDrv = lua.pkgs.${luaAttr};
|
|
|
|
luaDrv = (lua.pkgs.luaLib.overrideLuarocks originalLuaDrv (drv: {
|
|
extraConfig = ''
|
|
-- to create a flat hierarchy
|
|
lua_modules_path = "lua"
|
|
'';
|
|
})).overrideAttrs (drv: {
|
|
version = attrs.version or drv.version;
|
|
rockspecVersion = drv.rockspecVersion;
|
|
});
|
|
|
|
finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // {
|
|
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [
|
|
lua.pkgs.luarocksMoveDataFolder
|
|
];
|
|
}));
|
|
in
|
|
finalDrv
|