From 825a7f002c607ced057489ecd7fb1132b94c3c8b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2026 15:54:28 +0200 Subject: [PATCH 1/2] python3: avoid a small `rec` near passthruFun --- .../interpreters/python/cpython/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index c4325a4494f5..69209951c676 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -173,13 +173,19 @@ let }; in python; - in - passthruFun rec { - inherit self sourceVersion packageOverrides; - implementation = "cpython"; - libPrefix = "python${pythonVersion}${lib.optionalString (!enableGIL) "t"}"; - executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; + libPrefix = "python${pythonVersion}${lib.optionalString (!enableGIL) "t"}"; + in + passthruFun { + inherit + self + sourceVersion + packageOverrides + libPrefix + pythonVersion + ; + implementation = "cpython"; + executable = libPrefix; sitePackages = "lib/${libPrefix}/site-packages"; inherit hasDistutilsCxxPatch pythonAttr; inherit (splices) From 20a0e1b210e3c606c86cf8e2ca2a2172ce440475 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2026 16:20:08 +0200 Subject: [PATCH 2/2] python3: propagate overrides of spliced pythons This is a more accurate resurrection of what was meant to be done in 64214826833482bb3b4fd89b77aabf1248abe33b --- .../interpreters/python/cpython/default.nix | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 69209951c676..e674de90810f 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -165,12 +165,40 @@ let ); } // __splices; + # When we override the interpreter we also need to override the spliced + # versions of the interpreter. NOTE: In lua-5/interpreter.nix, this + # filter is different - we take every attribute from @inputs, besides + # derivations. That filter causes cross compilations issues for Python + # See e.g: + # + # pkgsCross.armv7l-hf-multiplatform.buildPackages.python3Packages.bcrypt + # + # And the following Nixpkgs issues/PRs: + # + # - https://github.com/NixOS/nixpkgs/issues/48046 + # - https://github.com/NixOS/nixpkgs/pull/480005 (Wrong PR) + # - https://github.com/NixOS/nixpkgs/pull/482866 (Correct fix) + # - https://github.com/NixOS/nixpkgs/pull/498251 (Re-adds this @inputs filter) + inputs' = lib.filterAttrs ( + n: v: + (builtins.elem (builtins.typeOf v) [ + "int" + "bool" + "string" + "path" + "null" + ]) + || n == "packageOverrides" + ) inputs; override = attr: let - python = attr.override { - self = python; - }; + python = attr.override ( + inputs' + // { + self = python; + } + ); in python; pythonVersion = with sourceVersion; "${major}.${minor}";