nixpkgs/pkgs/development/perl-modules/generic/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, perl, buildPerl, toPerlModule }:
2022-02-10 01:19:00 +00:00
{ buildInputs ? []
, nativeBuildInputs ? []
, outputs ? [ "out" "devdoc" ]
, src ? null
2022-02-10 01:19:00 +00:00
, doCheck ? true
, checkTarget ? "test"
2022-02-10 01:19:00 +00:00
# Prevent CPAN downloads.
, PERL_AUTOINSTALL ? "--skipdeps"
2022-02-10 01:19:00 +00:00
# From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
# authors to skip certain tests (or include certain tests) when
# the results are not being monitored by a human being."
, AUTOMATED_TESTING ? true
2022-02-10 01:19:00 +00:00
# current directory (".") is removed from @INC in Perl 5.26 but many old libs rely on it
# https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
, PERL_USE_UNSAFE_INC ? "1"
2022-02-10 01:19:00 +00:00
, ...
}@attrs:
2022-02-10 01:19:00 +00:00
assert attrs?pname -> attrs?version;
assert attrs?pname -> !(attrs?name);
lib.warnIf (attrs ? name) "builtPerlPackage: `name' (\"${attrs.name}\") is deprecated, use `pname' and `version' instead"
2022-02-10 01:19:00 +00:00
(let
defaultMeta = {
homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
platforms = perl.meta.platforms;
};
2022-02-10 01:19:00 +00:00
cleanedAttrs = builtins.removeAttrs attrs [
"meta" "builder" "version" "pname" "fullperl"
"buildInputs" "nativeBuildInputs" "buildInputs"
"PERL_AUTOINSTALL" "AUTOMATED_TESTING" "PERL_USE_UNSAFE_INC"
];
2022-02-10 01:19:00 +00:00
package = stdenv.mkDerivation ({
pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name`
version = lib.getVersion attrs; # TODO: phase-out `attrs.name`
2022-02-10 01:19:00 +00:00
builder = ./builder.sh;
2022-02-10 01:19:00 +00:00
buildInputs = buildInputs ++ [ perl ];
nativeBuildInputs = nativeBuildInputs ++ [ (perl.mini or perl) ];
2022-02-10 01:19:00 +00:00
fullperl = buildPerl;
2022-02-10 01:19:00 +00:00
inherit outputs src doCheck checkTarget;
inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC;
meta = defaultMeta // (attrs.meta or { });
} // cleanedAttrs);
in toPerlModule package)