2021-01-15 14:21:58 +01:00
|
|
|
{ lib, stdenv
|
2021-09-03 16:50:36 +02:00
|
|
|
, rtpPath
|
2018-12-27 10:34:14 +01:00
|
|
|
, vim
|
2021-09-03 16:50:36 +02:00
|
|
|
, vimGenDocHook
|
2018-12-27 10:34:14 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
rec {
|
|
|
|
addRtp = path: attrs: derivation:
|
2021-09-14 21:49:16 +02:00
|
|
|
derivation // { rtp = "${derivation}"; } // {
|
2018-12-27 10:34:14 +01: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 01:20:05 +02:00
|
|
|
path ? ".",
|
2018-12-27 10:34:14 +01:00
|
|
|
addonInfo ? null,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
|
|
|
|
name = namePrefix + name;
|
|
|
|
|
2021-09-16 18:45:32 +02:00
|
|
|
# dont move the doc folder since vim expects it
|
|
|
|
forceShare= [ "man" "info" ];
|
|
|
|
|
2021-09-18 07:49:07 +02:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
|
|
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) vimGenDocHook;
|
2018-12-27 10:34:14 +01: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 07:24:13 +02:00
|
|
|
# vim plugins may override this
|
|
|
|
buildPhase = ":";
|
|
|
|
configurePhase =":";
|
2018-12-27 10:34:14 +01:00
|
|
|
} // attrs);
|
|
|
|
}
|