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