2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv
|
2021-09-03 15:50:36 +01:00
|
|
|
, rtpPath
|
2018-12-27 09:34:14 +00:00
|
|
|
, vim
|
2021-09-03 15:50:36 +01:00
|
|
|
, vimGenDocHook
|
2018-12-27 09:34:14 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rec {
|
|
|
|
addRtp = path: attrs: derivation:
|
2021-09-14 20:49:16 +01: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-02 00:20:05 +01:00
|
|
|
path ? ".",
|
2018-12-27 09:34:14 +00:00
|
|
|
addonInfo ? null,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
|
|
|
|
name = namePrefix + name;
|
|
|
|
|
2021-09-03 15:50:36 +01:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or [] ++ [ 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 06:24:13 +01:00
|
|
|
# vim plugins may override this
|
|
|
|
buildPhase = ":";
|
|
|
|
configurePhase =":";
|
2018-12-27 09:34:14 +00:00
|
|
|
} // attrs);
|
|
|
|
}
|