Files
nixpkgs/pkgs/applications/editors/neovim/build-neovim-plugin.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

53 lines
1.3 KiB
Nix

{
lib,
lua,
toVimPlugin,
}:
let
# sanitizeDerivationName
normalizeName = lib.replaceStrings [ "." ] [ "-" ];
in
# function to create vim plugin from lua packages that are already packaged in
# luaPackages
{
# the lua derivation to convert into a neovim plugin
luaAttr ? (lua.pkgs.${normalizeName attrs.pname}),
...
}@attrs:
let
originalLuaDrv =
if (lib.typeOf luaAttr == "string") then
lib.warn
"luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)"
lua.pkgs.${normalizeName luaAttr}
else
luaAttr;
luaDrv = originalLuaDrv.overrideAttrs (oa: {
version = attrs.version or oa.version;
__intentionallyOverridingVersion = true;
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}";
__intentionallyOverridingVersion = true;
}
)
);
in
finalDrv