0ab2c96429
the `from2Nix` suffix is a legacy from vim2nix but we dont use that anymore. It makes the name of the function unusual and long.
51 lines
1 KiB
Nix
51 lines
1 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);
|
|
|
|
}
|