1 { lib, stdenv, perl, toPerlModule }:
4 , nativeBuildInputs ? []
5 , outputs ? [ "out" "devdoc" ]
8 # enabling or disabling does nothing for perl packages so set it explicitly
9 # to false to not change hashes when enableParallelBuildingByDefault is enabled
10 , enableParallelBuilding ? false
13 , checkTarget ? "test"
15 # Prevent CPAN downloads.
16 , PERL_AUTOINSTALL ? "--skipdeps"
18 # From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
19 # authors to skip certain tests (or include certain tests) when
20 # the results are not being monitored by a human being."
21 , AUTOMATED_TESTING ? true
23 # current directory (".") is removed from @INC in Perl 5.26 but many old libs rely on it
24 # https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
25 , PERL_USE_UNSAFE_INC ? "1"
32 lib.throwIf (attrs ? name) "buildPerlPackage: `name` (\"${attrs.name}\") is deprecated, use `pname` and `version` instead"
36 homepage = "https://metacpan.org/dist/${attrs.pname}";
37 inherit (perl.meta) platforms;
40 package = stdenv.mkDerivation (attrs // {
41 name = "perl${perl.version}-${attrs.pname}-${attrs.version}";
43 builder = ./builder.sh;
45 buildInputs = buildInputs ++ [ perl ];
46 nativeBuildInputs = nativeBuildInputs ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [ perl.mini ] else [ perl ]);
48 inherit outputs src doCheck checkTarget enableParallelBuilding;
50 inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC;
51 fullperl = perl.__spliced.buildHost or perl;
54 meta = defaultMeta // (attrs.meta or { });
57 in toPerlModule package)