Enable stdenv customization through (buildPython*.override { inherit stdenv; })#271762
Merged
ShamrockLee merged 4 commits intoNixOS:masterfrom Oct 24, 2025
Merged
Conversation
12 tasks
89f0bd1 to
279ab67
Compare
Contributor
Author
|
Simplify a bit. |
13 tasks
f6ddb6f to
93fb0e3
Compare
Contributor
Author
|
Reword the release note entry. |
Steinhagen
reviewed
Jan 31, 2024
93fb0e3 to
c1aee27
Compare
c1aee27 to
433a127
Compare
433a127 to
4d3b925
Compare
13 tasks
4d3b925 to
62fce45
Compare
5417064 to
71fee98
Compare
53 tasks
a0f5f69 to
e7d8504
Compare
On Nixpkgs >= 26.05 (or precisely, oldest supported release >= 25.11), warn about the use of buildPython*'s deprecated argument `stdenv`. Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
e7d8504 to
e05528c
Compare
13 tasks
Contributor
Author
|
@MattSturgeon I wrote some test cases locally (with the modularized Python |
Contributor
Author
|
Anyway, let's merge before the all-breaking-changes restriction. |
Contributor
|
If the tests are testing this PR's changes and/or testing that this PR doesn't break existing behaviour, then pushing them to this PR probably makes sense. |
Contributor
Author
|
Apology for not reacting earlier. I'll open a PR for the tests tomorrow morning (UTC+8). |
This was referenced Oct 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Now that #366593 has restored the missing
.overridetobuildPythonPackageandbuildPythonApplication, this allow specifying thestdenvused by the build helpers throughbuildPython*.override(as most build helpers do) instead of passing it directly intobuildPython*.The reason to move to
buildPythonPackage.override { stdenv = ...; }frombuildPythonPackage { stdenv = ...; }includes:The
buildPython* { inherit stdenv; ...; }will be impossible/unfeasible when taking fixed-point arguments (buildPython* (finalAttrs: { ...; })).lib.extendMkDerivationis on its way, but we need a clean ground to integrate it intobuildPython*.stdenvis a dependencybuildPythonPackagewould (directly or indirectly) get frompkgsthroughcallPackage. It makes better sense to change it through the.overrideattribute provided bycallPackage.In the future, we could get rid of all the special, impassable arguments, and pass everything properly either into
stdenv.mkDerivationor throughpassthru. This way, we only needoverrideAttrsto override attributes, without having to defined special overriders likeoverridePythonAttrsand for each language and framework.stdenvcould neither be passed intostdenv.mkDerivationor throughpassthru, sincestdenv.mkDerivaitonwill add astdenvattribute to the resulting derivation.For package definition that used to be:
can now become
In the future, when
buildPythonPackagealso takes fixed-point arguments, we could write:This PR depends on #366593.Initial effort for #271387.
Things done
nixos-install-tools)nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Priorities
Add a 👍 reaction to pull requests you find important.