mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
57 lines
1.2 KiB
Nix
57 lines
1.2 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}"
|
|
, namePrefix ? "vimplugin-"
|
|
, src
|
|
, unpackPhase ? ""
|
|
, configurePhase ? ""
|
|
, buildPhase ? ""
|
|
, preInstall ? ""
|
|
, postInstall ? ""
|
|
, path ? "."
|
|
, addonInfo ? null
|
|
, meta ? { }
|
|
, ...
|
|
}@attrs:
|
|
let
|
|
drv = stdenv.mkDerivation (attrs // {
|
|
name = namePrefix + 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);
|
|
|
|
buildVimPluginFrom2Nix = attrs: buildVimPlugin ({
|
|
# vim plugins may override this
|
|
buildPhase = ":";
|
|
configurePhase = ":";
|
|
} // attrs);
|
|
}
|