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:
|
|
|
|
derivation // { rtp = "${derivation}/${path}"; } // {
|
|
|
|
overrideAttrs = f: buildVimPlugin (attrs // f attrs);
|
|
|
|
};
|
|
|
|
|
|
|
|
buildVimPlugin = attrs@{
|
|
|
|
name ? "${attrs.pname}-${attrs.version}",
|
|
|
|
namePrefix ? "vimplugin-",
|
|
|
|
src,
|
|
|
|
unpackPhase ? "",
|
|
|
|
configurePhase ? "",
|
|
|
|
buildPhase ? "",
|
|
|
|
preInstall ? "",
|
|
|
|
postInstall ? "",
|
2021-01-15 13:21:58 +00:00
|
|
|
path ? lib.getName name,
|
2018-12-27 09:34:14 +00:00
|
|
|
addonInfo ? null,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
|
|
|
|
name = namePrefix + name;
|
|
|
|
|
2021-09-03 14:50:36 +00: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 05:24:13 +00:00
|
|
|
# vim plugins may override this
|
|
|
|
buildPhase = ":";
|
|
|
|
configurePhase =":";
|
2018-12-27 09:34:14 +00:00
|
|
|
} // attrs);
|
|
|
|
}
|