diff options
author | Malo Bourgon <mbourgon@gmail.com> | 2022-06-07 11:03:48 -0700 |
---|---|---|
committer | Malo Bourgon <mbourgon@gmail.com> | 2022-06-07 12:49:23 -0700 |
commit | 399732b449262e8e3183fd239274b284901c8d08 (patch) | |
tree | 4114e9d85f4c2eff33ad9b02ef48f9ec7c0e88f1 /pkgs/development/perl-modules/generic | |
parent | 61beb33b83c16339fdcd96680d2942040730679e (diff) |
buildPerlPackage: don't mess with `pname` and phase out use of `name`
Currently `buildPerlPackage` prefixes the Perl version to the package's `pname`, which results in `nix run` not being able to work for any packages build with it out of the box. This commit corrects that and phases out the ability to set `name` directly, as well as refactors the code to not require `cleanedAttrs`.
Diffstat (limited to 'pkgs/development/perl-modules/generic')
-rw-r--r-- | pkgs/development/perl-modules/generic/default.nix | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/pkgs/development/perl-modules/generic/default.nix b/pkgs/development/perl-modules/generic/default.nix index 9ff63c14e5188..2d1c550d3168c 100644 --- a/pkgs/development/perl-modules/generic/default.nix +++ b/pkgs/development/perl-modules/generic/default.nix @@ -27,26 +27,16 @@ , ... }@attrs: -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" +lib.throwIf (attrs ? name) "buildPerlPackage: `name` (\"${attrs.name}\") is deprecated, use `pname` and `version` instead" (let defaultMeta = { - homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name` - platforms = perl.meta.platforms; + homepage = "https://metacpan.org/dist/${attrs.pname}"; + inherit (perl.meta) platforms; }; - cleanedAttrs = builtins.removeAttrs attrs [ - "meta" "builder" "version" "pname" "fullperl" - "buildInputs" "nativeBuildInputs" "buildInputs" - "PERL_AUTOINSTALL" "AUTOMATED_TESTING" "PERL_USE_UNSAFE_INC" - ]; - - package = stdenv.mkDerivation ({ - pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name` - version = lib.getVersion attrs; # TODO: phase-out `attrs.name` + package = stdenv.mkDerivation (attrs // { + name = "perl${perl.version}-${attrs.pname}-${attrs.version}"; builder = ./builder.sh; @@ -59,6 +49,6 @@ lib.warnIf (attrs ? name) "builtPerlPackage: `name' (\"${attrs.name}\") is depre inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC; meta = defaultMeta // (attrs.meta or { }); - } // cleanedAttrs); + }); in toPerlModule package) |