Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, rtpPath 4, toVimPlugin 5}: 6 7rec { 8 addRtp = drv: 9 drv // { 10 rtp = lib.warn "`rtp` attribute is deprecated, use `outPath` instead." drv.outPath; 11 overrideAttrs = f: addRtp (drv.overrideAttrs f); 12 }; 13 14 buildVimPlugin = 15 { name ? "${attrs.pname}-${attrs.version}" 16 , namePrefix ? "vimplugin-" 17 , src 18 , unpackPhase ? "" 19 , configurePhase ? "" 20 , buildPhase ? "" 21 , preInstall ? "" 22 , postInstall ? "" 23 , path ? "." 24 , addonInfo ? null 25 , meta ? { } 26 , ... 27 }@attrs: 28 let 29 drv = stdenv.mkDerivation (attrs // { 30 name = namePrefix + name; 31 32 inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall; 33 34 installPhase = '' 35 runHook preInstall 36 37 target=$out/${rtpPath}/${path} 38 mkdir -p $out/${rtpPath} 39 cp -r . $target 40 41 runHook postInstall 42 ''; 43 44 meta = { 45 platforms = lib.platforms.all; 46 } // meta; 47 }); 48 in 49 addRtp (toVimPlugin drv); 50 51 buildVimPluginFrom2Nix = attrs: buildVimPlugin ({ 52 # vim plugins may override this 53 buildPhase = ":"; 54 configurePhase = ":"; 55 } // attrs); 56}