c59cbaf5bf
Neovim plugins built with buildNeovimPlugin are based on derivations from the lua package set, ie., they are a flat-install (no share/lua/5.1 nesting) with some post-processing. While debugging, I noticed their name lacked the vimplugin prefix, making them a bit harder to diagnose if the derivation was the vimplugin or not. So I hardcoded 'namePrefix' (why let the user change that ?) and moved it to toVimPlugin so it applies to lua-based plugins as well. Before this PR: ➜ nix-build -A vimPlugins.plenary-nvim /nix/store/zyvdf7c1k4q2ykg6jydpf5c31g9j921s-lua5.1-plenary.nvim-scm-1-unstable-2024-03-25 After this PR ➜ nix-build -A vimPlugins.plenary-nvim /nix/store/dy4rjzjbhshi109i6969f39vd9xbjgs1-vimplugin-lua5.1-plenary.nvim-scm-1-unstable-2024-03-25
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, rtpPath
|
|
, toVimPlugin
|
|
}:
|
|
|
|
rec {
|
|
addRtp = drv:
|
|
drv // {
|
|
rtp = lib.warn "`rtp` attribute is deprecated, use `outPath` instead." drv.outPath;
|
|
overrideAttrs = f: addRtp (drv.overrideAttrs f);
|
|
};
|
|
|
|
buildVimPlugin =
|
|
{ name ? "${attrs.pname}-${attrs.version}"
|
|
, src
|
|
, unpackPhase ? ""
|
|
, configurePhase ? ":"
|
|
, buildPhase ? ":"
|
|
, preInstall ? ""
|
|
, postInstall ? ""
|
|
, path ? "."
|
|
, addonInfo ? null
|
|
, meta ? { }
|
|
, ...
|
|
}@attrs:
|
|
let
|
|
drv = stdenv.mkDerivation (attrs // {
|
|
name = lib.warnIf (attrs ? vimprefix) "The 'vimprefix' is now hardcoded in toVimPlugin" name;
|
|
|
|
inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
target=$out/${rtpPath}/${path}
|
|
mkdir -p $out/${rtpPath}
|
|
cp -r . $target
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
platforms = lib.platforms.all;
|
|
} // meta;
|
|
});
|
|
in
|
|
addRtp (toVimPlugin drv);
|
|
|
|
}
|