Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 perl, 5 toPerlModule, 6}: 7 8{ 9 buildInputs ? [ ], 10 nativeBuildInputs ? [ ], 11 outputs ? [ 12 "out" 13 "devdoc" 14 ], 15 src ? null, 16 17 # enabling or disabling does nothing for perl packages so set it explicitly 18 # to false to not change hashes when enableParallelBuildingByDefault is enabled 19 enableParallelBuilding ? false, 20 21 doCheck ? true, 22 checkTarget ? "test", 23 24 # Prevent CPAN downloads. 25 PERL_AUTOINSTALL ? "--skipdeps", 26 27 # From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows 28 # authors to skip certain tests (or include certain tests) when 29 # the results are not being monitored by a human being." 30 AUTOMATED_TESTING ? true, 31 32 # current directory (".") is removed from @INC in Perl 5.26 but many old libs rely on it 33 # https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC 34 PERL_USE_UNSAFE_INC ? "1", 35 36 env ? { }, 37 38 ... 39}@attrs: 40 41lib.throwIf (attrs ? name) 42 "buildPerlPackage: `name` (\"${attrs.name}\") is deprecated, use `pname` and `version` instead" 43 44 ( 45 let 46 defaultMeta = { 47 homepage = "https://metacpan.org/dist/${attrs.pname}"; 48 inherit (perl.meta) platforms; 49 }; 50 51 package = stdenv.mkDerivation ( 52 attrs 53 // { 54 name = "perl${perl.version}-${attrs.pname}-${attrs.version}"; 55 56 builder = ./builder.sh; 57 58 buildInputs = buildInputs ++ [ perl ]; 59 nativeBuildInputs = 60 nativeBuildInputs 61 ++ (if !(stdenv.buildPlatform.canExecute stdenv.hostPlatform) then [ perl.mini ] else [ perl ]); 62 63 inherit 64 outputs 65 src 66 doCheck 67 checkTarget 68 enableParallelBuilding 69 ; 70 env = { 71 inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC; 72 fullperl = perl.__spliced.buildHost or perl; 73 } 74 // env; 75 76 meta = defaultMeta // (attrs.meta or { }); 77 } 78 ); 79 80 in 81 toPerlModule package 82 )