Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlPackages: make package set extensible #87299

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

B4dM4n
Copy link
Contributor

@B4dM4n B4dM4n commented May 8, 2020

Motivation for this change

Add the same overriding capabilities to the perlPackages set that pythonPackages and luaPackages already have.

Things done

It uses the same packageOverrides argument that pythonPackages and luaPackages also use and keeps the old config.perlPackageOverrides method.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@B4dM4n
Copy link
Contributor Author

B4dM4n commented May 8, 2020

cc @volth @edolstra

@B4dM4n
Copy link
Contributor Author

B4dM4n commented May 9, 2020

The one rebuild was ikiwiki, which uses perlPackages.override to pass a modified pkgs set into perl-packages.nix.

I pushed a new version which passes along the pkgs from perl-modules/default.nix to perl-packages.nix to add that possibility again.

@rycee
Copy link
Member

rycee commented Jun 3, 2020

Unfortunately I'm swamped with a bunch of other stuff, and also no longer work with Perl, so I cannot review this properly but I agree with the general idea of making the package set extensible.

@B4dM4n
Copy link
Contributor Author

B4dM4n commented Jul 13, 2020

Rebased onto master to resolve merge conflict.

@B4dM4n
Copy link
Contributor Author

B4dM4n commented Jan 13, 2021

Rebased again

@aanderse aanderse requested a review from jtojnar January 13, 2021 16:57
Copy link
Member

@stigtsp stigtsp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Can you provide a code example?

@B4dM4n
Copy link
Contributor Author

B4dM4n commented Jan 14, 2021

It allows to recursively override or add a dependency in a perlPackages set:

perlPackages.extend (self: super: with self; {
  ModuleBuild = buildPerlPackage {
    pname = "Module-Build";
    version = "0.4229";
    src = fetchurl { ... };
  };
})

This can also be done with the packageOverrides argument, the same way as in python:

let
  perl = pkgs.perl.override {
    packageOverrides = self: super: with self; {
      ModuleBuild = buildPerlPackage {
        pname = "Module-Build";
        version = "0.4229";
        src = pkgs.fetchurl {
          url = "mirror://cpan/authors/id/L/LE/LEONT/Module-Build-0.4229.tar.gz";
          sha256 = "H+SRps2pFLAbyOWS+qK1QE6fNZFcoVMi+PKo2PkAjBg=";
        };
      };
    };
  };
in
perl.pkgs.CPAN

Copy link
Member

@stigtsp stigtsp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the examples, this is very useful. Tested both approaches OK, and looks good to me.

@B4dM4n
Copy link
Contributor Author

B4dM4n commented Jan 18, 2021

After looking at the pythonPackages set I just realized that most language package sets are build with lib.makeScope instead of lib.makeExtensible. They function very similar, but lib.makeScope automatically provides a newScope and callPackage function and is specifically made to Make a set of packages with a common scope.

Should I update this PR with a lib.makeScope version? The changes will be very similar.

Only the first code example from above would change from perlPackages.extend to perlPackages.overrideScope', which has the same arguments/effect.

@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@amarshall
Copy link
Member

I find myself wanting of this. Are folks still amenable to it being merged after a rebase? @B4dM4n if you’re unwilling I can rebase and open a new PR.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 13, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank marked this pull request as draft March 20, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants