2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv
|
2021-09-03 14:50:36 +00:00
|
|
|
, rtpPath
|
2018-12-27 09:34:14 +00:00
|
|
|
, vim
|
2021-09-03 14:50:36 +00:00
|
|
|
, vimGenDocHook
|
2018-12-27 09:34:14 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rec {
|
|
|
|
addRtp = path: attrs: derivation:
|
2021-09-14 19:49:16 +00:00
|
|
|
derivation // { rtp = "${derivation}"; } // {
|
2018-12-27 09:34:14 +00:00
|
|
|
overrideAttrs = f: buildVimPlugin (attrs // f attrs);
|
|
|
|
};
|
|
|
|
|
|
|
|
buildVimPlugin = attrs@{
|
|
|
|
name ? "${attrs.pname}-${attrs.version}",
|
|
|
|
namePrefix ? "vimplugin-",
|
|
|
|
src,
|
|
|
|
unpackPhase ? "",
|
|
|
|
configurePhase ? "",
|
|
|
|
buildPhase ? "",
|
|
|
|
preInstall ? "",
|
|
|
|
postInstall ? "",
|
2021-09-01 23:20:05 +00:00
|
|
|
path ? ".",
|
2018-12-27 09:34:14 +00:00
|
|
|
addonInfo ? null,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
|
|
|
|
name = namePrefix + name;
|
|
|
|
|
2021-09-16 16:45:32 +00:00
|
|
|
# dont move the doc folder since vim expects it
|
|
|
|
forceShare= [ "man" "info" ];
|
|
|
|
|
2021-09-18 05:49:07 +00:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
|
|
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) vimGenDocHook;
|
2018-12-27 09:34:14 +00:00
|
|
|
inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
target=$out/${rtpPath}/${path}
|
|
|
|
mkdir -p $out/${rtpPath}
|
|
|
|
cp -r . $target
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
}));
|
|
|
|
|
|
|
|
buildVimPluginFrom2Nix = attrs: buildVimPlugin ({
|
2021-08-05 05:24:13 +00:00
|
|
|
# vim plugins may override this
|
|
|
|
buildPhase = ":";
|
|
|
|
configurePhase =":";
|
2018-12-27 09:34:14 +00:00
|
|
|
} // attrs);
|
|
|
|
}
|