depot/third_party/nixpkgs/pkgs/applications/editors/neovim/build-neovim-plugin.nix
Default email c7cb07f092 Project import generated by Copybara.
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
2024-02-29 21:09:43 +01:00

39 lines
1 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 = originalLuaDrv.overrideAttrs (oa: {
version = attrs.version or oa.version;
rockspecVersion = oa.rockspecVersion;
extraConfig = ''
-- to create a flat hierarchy
lua_modules_path = "lua"
'';
});
finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // {
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [
lua.pkgs.luarocksMoveDataFolder
];
version = "${originalLuaDrv.version}-unstable-${oa.version}";
}));
in
finalDrv