Skip to content

python3: propagate overrides of spliced pythons#498251

Merged
doronbehar merged 2 commits intoNixOS:masterfrom
doronbehar:pkg/python-overrides--splicing
Mar 13, 2026
Merged

python3: propagate overrides of spliced pythons#498251
doronbehar merged 2 commits intoNixOS:masterfrom
doronbehar:pkg/python-overrides--splicing

Conversation

@doronbehar
Copy link
Contributor

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@doronbehar doronbehar requested a review from lheckemann March 9, 2026 14:52
@nixpkgs-ci nixpkgs-ci bot requested review from mweinelt and natsukium March 9, 2026 14:58
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 6.topic: python Python is a high-level, general-purpose programming language. labels Mar 9, 2026
@doronbehar doronbehar force-pushed the pkg/python-overrides--splicing branch from 405958f to 5008a3b Compare March 9, 2026 15:16
}
// __splices;
# When we override the interpreter we also need to override the spliced versions of the interpreter
inputs' = lib.filterAttrs (
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, this would still have the surprising override-dropping behaviour if inputs to the python package are overridden, e.g. python.override { sqlite = sqlite-interactive; }?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand correctly, this would still have the surprising override-dropping behaviour if inputs to the python package are overridden, e.g. python.override { sqlite = sqlite-interactive; }?

That behavior was present before 6421482 , due to the !lib.isDerivation condition used in the filter. TBH I'm not sure why that filter function was breaking the splicing for pkgsCross.armv7l-hf-multiplatform.buildPackages.python3Packages.setuptools-rust. After opening the current PR, I noticed the Lua ecosystem also uses the same filter and pretty much the same code:

# copied from python
passthru =
let
# When we override the interpreter we also need to override the spliced versions of the interpreter
inputs' = lib.filterAttrs (n: v: !lib.isDerivation v && n != "passthruFun") inputs;
override =
attr:
let
lua = attr.override (inputs' // { self = lua; });
in
lua;
in

I'm involved in cross compilation of lua packages too, and I haven't noticed equivalent issues. Maybe that's due to the @inputs in lua-5/interpreter.nix v.s cpython/default.nix.

Do you think the correct thing to do now would be to investigate why this lib.filter won't work for Python? Or maybe add a NOTE comment?

Copy link
Member

Choose a reason for hiding this comment

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

Given that this PR doesn't introduce any new breakage, and at least partially fixes the existing breakage, I think it's good.

Maybe opening a new issue would be better than a note, but I'm also not sure if anyone really has the problem I'm describing (I do struggle to think of a real use case for overriding python inputs where an overlay replacing the package for all of nixpkgs wouldn't be the more sensible approach).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lheckemann I just realized that packageOverrides - an important @inputs argument should also be propagated to all of these Pythons, so I added it, along with a comment striving to thoroughly explain the situation. If you could give it one more round of review it'd be great.

Copy link
Member

Choose a reason for hiding this comment

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

Seems sensible :)

@lheckemann
Copy link
Member

This does fix the specific problem I was having though, thanks for looking into it!

This is a more accurate resurrection of what was meant to be done in
6421482
@doronbehar doronbehar force-pushed the pkg/python-overrides--splicing branch from 7bc2f59 to 20a0e1b Compare March 13, 2026 10:56
@doronbehar doronbehar added this pull request to the merge queue Mar 13, 2026
Merged via the queue into NixOS:master with commit 094f4cb Mar 13, 2026
29 of 32 checks passed
@doronbehar doronbehar deleted the pkg/python-overrides--splicing branch March 13, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants