2022-06-19 12:18:16 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-09-11 19:48:38 +00:00
|
|
|
, lua
|
2022-06-19 12:18:16 +00:00
|
|
|
, 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
|
2022-09-11 19:48:38 +00:00
|
|
|
originalLuaDrv = lua.pkgs.${luaAttr};
|
|
|
|
|
|
|
|
luaDrv = (lua.pkgs.luaLib.overrideLuarocks originalLuaDrv (drv: {
|
2022-06-19 12:18:16 +00:00
|
|
|
extraConfig = ''
|
|
|
|
-- to create a flat hierarchy
|
|
|
|
lua_modules_path = "lua"
|
|
|
|
'';
|
2022-09-11 19:48:38 +00:00
|
|
|
})).overrideAttrs (drv: {
|
|
|
|
version = attrs.version;
|
|
|
|
rockspecVersion = drv.rockspecVersion;
|
2022-06-19 12:18:16 +00:00
|
|
|
});
|
2022-09-11 19:48:38 +00:00
|
|
|
|
|
|
|
finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // {
|
2022-06-19 12:18:16 +00:00
|
|
|
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [
|
2022-09-11 19:48:38 +00:00
|
|
|
lua.pkgs.luarocksMoveDataFolder
|
2022-06-19 12:18:16 +00:00
|
|
|
];
|
|
|
|
}));
|
|
|
|
in
|
|
|
|
finalDrv
|