mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 18:23:09 +00:00
e7f619c49b
nativeBuildInputs when native compiling
53 lines
1.2 KiB
Nix
53 lines
1.2 KiB
Nix
{ lib, stdenv
|
|
, rtpPath
|
|
, vim
|
|
, vimCommandCheckHook
|
|
, vimGenDocHook
|
|
, neovimRequireCheckHook
|
|
}:
|
|
|
|
rec {
|
|
buildVimPlugin = attrs@{
|
|
name ? "${attrs.pname}-${attrs.version}",
|
|
namePrefix ? "vimplugin-",
|
|
src,
|
|
unpackPhase ? "",
|
|
configurePhase ? "",
|
|
buildPhase ? "",
|
|
preInstall ? "",
|
|
postInstall ? "",
|
|
path ? ".",
|
|
addonInfo ? null,
|
|
...
|
|
}:
|
|
let drv = stdenv.mkDerivation (attrs // {
|
|
name = namePrefix + name;
|
|
|
|
# dont move the doc folder since vim expects it
|
|
forceShare= [ "man" "info" ];
|
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
|
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ vimCommandCheckHook vimGenDocHook ];
|
|
inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
target=$out/${rtpPath}/${path}
|
|
mkdir -p $out/${rtpPath}
|
|
cp -r . $target
|
|
|
|
runHook postInstall
|
|
'';
|
|
});
|
|
in drv.overrideAttrs(oa: {
|
|
rtp = "${drv}";
|
|
});
|
|
|
|
buildVimPluginFrom2Nix = attrs: buildVimPlugin ({
|
|
# vim plugins may override this
|
|
buildPhase = ":";
|
|
configurePhase =":";
|
|
} // attrs);
|
|
}
|