Skip to content

buildPython*: simplify overrideStdenvCompat and add nested-override support#455764

Merged
ShamrockLee merged 4 commits intoNixOS:masterfrom
MattSturgeon:simplify-mkpyoverridable
Dec 12, 2025
Merged

buildPython*: simplify overrideStdenvCompat and add nested-override support#455764
ShamrockLee merged 4 commits intoNixOS:masterfrom
MattSturgeon:simplify-mkpyoverridable

Conversation

@MattSturgeon
Copy link
Contributor

@MattSturgeon MattSturgeon commented Oct 26, 2025

  • We don't need setFunctionArgs now stdenv is dropped as an explicit parameter from the underlying mk-python-derivation.nix files
  • Instead, we can removeAttrs args [ "stdenv "] to ensure the arg isn't needlessly applied
  • While it may be nice to "drop" the compatibility layer from already-overridden build-helpers, this will break in unexpected ways (including .overridePythonAttrs { stdenv })

With this change, the overridePythonAttrs-override-clangStdenv-deprecated-nested test I suggested in #455462 (comment) now passes.

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.

Add a 👍 reaction to pull requests you find important.

@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 Oct 26, 2025
@nix-owners nix-owners bot requested review from mweinelt and natsukium October 26, 2025 09:30
@ShamrockLee
Copy link
Contributor

How clever!

It would be excellent if we merge PR #455462 first and add tests for this PR.

`fdrv` → `newArgs`; the parameter is not a derivation, so fdrv is
confusing.
The underlying `mk-python-derivation.nix` functions do not have `stdenv`
in their functionArgs, so it was redundant to explicitly remove it.
Avoid passing `stdenv` to the underlying function when it is already
handled in overrideStdenvCompat.
This is needed to support the deprecated method of overriding `stdenv`
via `overridePythonAttrs`.
@MattSturgeon MattSturgeon force-pushed the simplify-mkpyoverridable branch from b2a72fc to 553a6c3 Compare December 11, 2025 01:15
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 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. labels Dec 11, 2025
@ShamrockLee
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 455764
Commit: 553a6c3d3a181a57dc87b250643bac59317ae9fc (subsequent changes)
Merge: b8337a7370fb855c5b4e480372f4be4307cc4a37

Logs: https://github.com/ShamrockLee/nixpkgs-review-gha/actions/runs/20159569822


x86_64-linux

✅ 1 package built:
  • tests.overriding

aarch64-linux

✅ 1 package built:
  • tests.overriding

x86_64-darwin (sandbox = relaxed)

✅ 1 package built:
  • tests.overriding

aarch64-darwin (sandbox = relaxed)

✅ 1 package built:
  • tests.overriding

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Dec 12, 2025
@ShamrockLee ShamrockLee added this pull request to the merge queue Dec 12, 2025
Merged via the queue into NixOS:master with commit 2f7c804 Dec 12, 2025
39 of 41 checks passed
@MattSturgeon MattSturgeon deleted the simplify-mkpyoverridable branch December 12, 2025 08:26
@ShamrockLee ShamrockLee added the backport release-25.11 Backport PR automatically label Dec 12, 2025
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Dec 12, 2025

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Dec 12, 2025
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. 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants