forked from mirrors/nixpkgs
56f823dd5c
nixpkgs creates a hierarchy of 3 folders share/runtime/<PKG_NAME> for no reason ? makes debugging harder as well as paths longer when patching so this removes this nested folders.
49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
{ lib, stdenv
|
|
, rtpPath
|
|
, vim
|
|
, vimGenDocHook
|
|
}:
|
|
|
|
rec {
|
|
addRtp = path: attrs: derivation:
|
|
derivation // { rtp = "${derivation}/${path}"; } // {
|
|
overrideAttrs = f: buildVimPlugin (attrs // f attrs);
|
|
};
|
|
|
|
buildVimPlugin = attrs@{
|
|
name ? "${attrs.pname}-${attrs.version}",
|
|
namePrefix ? "vimplugin-",
|
|
src,
|
|
unpackPhase ? "",
|
|
configurePhase ? "",
|
|
buildPhase ? "",
|
|
preInstall ? "",
|
|
postInstall ? "",
|
|
path ? ".",
|
|
addonInfo ? null,
|
|
...
|
|
}:
|
|
addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
|
|
name = namePrefix + name;
|
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or [] ++ [ vimGenDocHook ];
|
|
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 ({
|
|
# vim plugins may override this
|
|
buildPhase = ":";
|
|
configurePhase =":";
|
|
} // attrs);
|
|
}
|