nixpkgs/pkgs/applications/editors/vim/plugins/build-vim-plugin.nix
Matthieu Coudron 0ab2c96429 vimUtils: buildVimPluginFrom2Nix renamed to buildVimPlugin
the `from2Nix` suffix is a legacy from vim2nix but we dont use that anymore. It makes the name of the function unusual and long.
2023-09-27 19:08:38 +02:00

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);
}