diff --git a/hooks/default.nix b/hooks/default.nix index cd4219a1c..4224eaf89 100644 --- a/hooks/default.nix +++ b/hooks/default.nix @@ -35,8 +35,9 @@ let substitutions = { # NOTE: We have to use a non-overlayed Python here because otherwise we run into an infinite recursion # because building of tomlkit and its dependencies also use these hooks. - pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ]; - pythonInterpreter = nonOverlayedPython.interpreter; + # pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ]; + inherit pythonSitePackages; + inherit pythonInterpreter; inherit pyprojectPatchScript; inherit fields; inherit kind; diff --git a/overrides/default.nix b/overrides/default.nix index 5e289e151..34f8b344f 100644 --- a/overrides/default.nix +++ b/overrides/default.nix @@ -149,6 +149,16 @@ lib.composeManyExtensions [ rm $out/bin/tensorboard ''; }; + pythonFromPkgs = { + "3.6" = pkgs.python36; + "3.7" = pkgs.python37; + "3.8" = pkgs.python38; + "3.9" = pkgs.python39; + "3.10" = pkgs.python310; + "3.11" = pkgs.python311; + "3.12" = pkgs.python312; + "3.13" = pkgs.python313; + }.${lib.versions.majorMinor prev.python.version}; in { @@ -410,13 +420,13 @@ lib.composeManyExtensions [ # apply necessary patches in postInstall if the source is a wheel postInstall = lib.optionalString (old.src.isWheel or false) '' pushd "$out/${final.python.sitePackages}" - for patch in ${lib.concatMapStringsSep " " (p: "${p}") pkgs.python3.pkgs.cairocffi.patches}; do + for patch in ${lib.concatMapStringsSep " " (p: "${p}") pythonFromPkgs.pkgs.cairocffi.patches}; do patch -p1 < "$patch" done popd ''; } // lib.optionalAttrs (!(old.src.isWheel or false)) { - inherit (pkgs.python3.pkgs.cairocffi) patches; + inherit (pythonFromPkgs.pkgs.cairocffi) patches; } ); @@ -1288,7 +1298,7 @@ lib.composeManyExtensions [ jira = prev.jira.overridePythonAttrs ( old: { - inherit (pkgs.python3Packages.jira) patches; + inherit (pythonFromPkgs.pkgs.jira) patches; buildInputs = old.buildInputs or [ ] ++ [ final.pytestrunner final.cryptography @@ -1837,7 +1847,7 @@ lib.composeManyExtensions [ }; }; in - { + { # fails to build with format=pyproject and setuptools >= 65 format = if ((old.format or null) == "poetry2nix") then @@ -2235,7 +2245,7 @@ lib.composeManyExtensions [ pillow = prev.pillow.overridePythonAttrs ( old: let - preConfigure = (old.preConfigure or "") + pkgs.python3.pkgs.pillow.preConfigure; + preConfigure = (old.preConfigure or "") + pythonFromPkgs.pkgs.pillow.preConfigure; in { nativeBuildInputs = old.nativeBuildInputs or [ ] @@ -3821,7 +3831,7 @@ lib.composeManyExtensions [ # Fix library paths postPatch = lib.optionalString (!(old.src.isWheel or false)) (old.postPatch or "" + '' - ${pkgs.python3.interpreter} ${./shapely-rewrite.py} shapely/geos.py + ${pythonFromPkgs.interpreter} ${./shapely-rewrite.py} shapely/geos.py substituteInPlace pyproject.toml --replace-warn 'setuptools<64' 'setuptools' ''); } @@ -4046,7 +4056,7 @@ lib.composeManyExtensions [ vispy = prev.vispy.overrideAttrs ( _: { - inherit (pkgs.python3.pkgs.vispy) patches; + inherit (pythonFromPkgs.pkgs.vispy) patches; } ); @@ -4139,7 +4149,7 @@ lib.composeManyExtensions [ weasyprint = prev.weasyprint.overridePythonAttrs ( old: { - inherit (pkgs.python3.pkgs.weasyprint) patches; + inherit (pythonFromPkgs.pkgs.weasyprint) patches; nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ final.pytest-runner ]; buildInputs = old.buildInputs or [ ] ++ [ final.pytest-runner ]; }