Skip to content

Commit

Permalink
Fix composability of python package overriding
Browse files Browse the repository at this point in the history
As discussed at NixOS/nixpkgs#44426, `packageOverrides` is not
composable. Haskell packaging has (had?) a similar problem.

The solution, which works fairly elegantly, is to instead use
`python3.pkgs.overrideScope` to define a new set of `pkgs`, and replace
the original `python3.pkgs` with that.

Importantly, the arguments to `packageOverrides` do not need to change,
to be used with `overrideScope`.

Note, also, that `python3.pkgs.overrideScope` corresponds to
`lib.overrideScope'` (with the prime).
  • Loading branch information
dbaynard committed Dec 5, 2022
1 parent f03ee97 commit 9b93bee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dependencies/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ let
in
{
overlays.python = final: prev: {
python3 = prev.python3.override {
packageOverrides = lib.composeManyExtensions [
python3 = prev.python3 // {
pkgs = prev.python3.pkgs.overrideScope (lib.composeManyExtensions [
(_: _: newPackages final prev)
];
]);
};

python3Packages = final.python3.pkgs;
Expand Down

0 comments on commit 9b93bee

Please sign in to comment.