2022-06-26 10:26:21 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-10-30 15:09:59 +00:00
|
|
|
, lua
|
2022-06-26 10:26:21 +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-10-30 15:09:59 +00:00
|
|
|
originalLuaDrv = lua.pkgs.${luaAttr};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
luaDrv = originalLuaDrv.overrideAttrs (oa: {
|
|
|
|
version = attrs.version or oa.version;
|
|
|
|
rockspecVersion = oa.rockspecVersion;
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
extraConfig = ''
|
|
|
|
-- to create a flat hierarchy
|
|
|
|
lua_modules_path = "lua"
|
|
|
|
'';
|
|
|
|
});
|
2022-10-30 15:09:59 +00:00
|
|
|
|
|
|
|
finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // {
|
2022-06-26 10:26:21 +00:00
|
|
|
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [
|
2022-10-30 15:09:59 +00:00
|
|
|
lua.pkgs.luarocksMoveDataFolder
|
2022-06-26 10:26:21 +00:00
|
|
|
];
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "${originalLuaDrv.version}-unstable-${oa.version}";
|
2022-06-26 10:26:21 +00:00
|
|
|
}));
|
|
|
|
in
|
|
|
|
finalDrv
|