mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
423788f5b8
* buildNeovimPlugin: pass a derivation to luaAttr and deprecate passing a string. Passing a string is not a typical/good nixpkgs habit. We want to give more control on which attribute to wrap, without having to add it to the lua package set necessarily. * vimPlugins: update plugin with new syntax buildNeovimPlugin now accepts derivations instead of the lua package name. This PR reflects the change
42 lines
1.2 KiB
Nix
42 lines
1.2 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 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;
|
|
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
|