diff --git a/default.nix b/default.nix index 300b5c5eb..1a2600f17 100644 --- a/default.nix +++ b/default.nix @@ -247,7 +247,8 @@ lib.makeScope pkgs.newScope (self: { final: _prev: { mkPoetryDep = final.callPackage ./mk-poetry-dep.nix { - inherit lib python poetryLib pep508Env pyVersion; + inherit lib poetryLib pep508Env pyVersion; + python = py; inherit pyproject-nix; }; diff --git a/flake.lock b/flake.lock index a92665cc9..f6466f757 100644 --- a/flake.lock +++ b/flake.lock @@ -40,15 +40,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730157240, - "narHash": "sha256-P8wF4ag6Srmpb/gwskYpnIsnspbjZlRvu47iN527ABQ=", + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "75e28c029ef2605f9841e0baa335d70065fe7ae2", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixos-24.11", "repo": "nixpkgs", "rev": "75e28c029ef2605f9841e0baa335d70065fe7ae2", "type": "github" diff --git a/flake.nix b/flake.nix index 487973019..3b44938a6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,8 +3,7 @@ inputs = { flake-utils.url = "github:numtide/flake-utils"; - # Last working commit from nixos-small-unstable - nixpkgs.url = "github:NixOS/nixpkgs?rev=75e28c029ef2605f9841e0baa335d70065fe7ae2"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hooks/default.nix b/hooks/default.nix index 03b974e18..4224eaf89 100644 --- a/hooks/default.nix +++ b/hooks/default.nix @@ -5,7 +5,18 @@ let pythonInterpreter = pythonOnBuildForHost.interpreter; pythonSitePackages = python.sitePackages; - nonOverlayedPython = (pkgs.python3.pythonOnBuildForHost or pkgs.python3.pythonForBuild).withPackages (ps: [ ps.tomlkit ]); + 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 python.version}; + + nonOverlayedPython = (pythonFromPkgs.pythonOnBuildForHost or pythonFromPkgs.pythonForBuild).withPackages (ps: [ ps.tomlkit ps.pip ]); makeRemoveSpecialDependenciesHook = { fields , kind @@ -24,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; @@ -59,15 +71,16 @@ in pipBuildHook = callPackage ( - { pip, wheel }: + { wheel }: makeSetupHook ({ name = "pip-build-hook.sh"; substitutions = { - inherit pythonInterpreter pythonSitePackages; + inherit pythonSitePackages; + inherit pythonInterpreter; }; } - // (makeSetupHookArgs [ pip wheel ])) + // (makeSetupHookArgs [ nonOverlayedPython.pkgs.pip wheel ])) ./pip-build-hook.sh ) { }; diff --git a/overrides/default.nix b/overrides/default.nix index ad475674e..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 { @@ -179,9 +189,7 @@ lib.composeManyExtensions [ inherit (final) buildPythonPackage flit-core tomli; }; - wheel = bootstrappingBase.wheel.override { - inherit (final) buildPythonPackage flit-core; - }; + inherit (bootstrappingBase) cython cython_0; #### END bootstrapping pkgs @@ -412,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; } ); @@ -913,6 +921,17 @@ lib.composeManyExtensions [ (lib.optionals (final ? fastapi-cli) [ final.fastapi-cli ]); }); + uvicorn = prev.uvicorn.overridePythonAttrs (old: { + optional-dependencies.standard = [ + prev.httptools + prev.python-dotenv + prev.pyyaml + prev.uvloop + prev.watchfiles + prev.websockets + ]; + }); + fastecdsa = prev.fastecdsa.overridePythonAttrs (old: { buildInputs = old.buildInputs or [ ] ++ [ pkgs.gmp.dev ]; }); @@ -1279,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 @@ -1828,7 +1847,7 @@ lib.composeManyExtensions [ }; }; in - { + { # fails to build with format=pyproject and setuptools >= 65 format = if ((old.format or null) == "poetry2nix") then @@ -2226,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 [ ] @@ -3812,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' ''); } @@ -4037,7 +4056,7 @@ lib.composeManyExtensions [ vispy = prev.vispy.overrideAttrs ( _: { - inherit (pkgs.python3.pkgs.vispy) patches; + inherit (pythonFromPkgs.pkgs.vispy) patches; } ); @@ -4130,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 ]; } @@ -4311,6 +4330,14 @@ lib.composeManyExtensions [ ''; }); + wheel = prev.wheel.overridePythonAttrs (old: rec { + version = "0.45.1"; + src = old.src.override (oldSrc: { + rev = "refs/tags/${version}"; + hash = "sha256-tgueGEWByS5owdA5rhXGn3qh1Vtf0HGYC6+BHfrnGAs="; + }); + }); + marisa-trie = prev.marisa-trie.overridePythonAttrs ( old: { buildInputs = old.buildInputs or [ ] ++ [ final.pytest-runner ]; diff --git a/templates/app/flake.nix b/templates/app/flake.nix index f630ddae1..97605086b 100644 --- a/templates/app/flake.nix +++ b/templates/app/flake.nix @@ -3,8 +3,7 @@ inputs = { flake-utils.url = "github:numtide/flake-utils"; - # Last working commit from nixos-small-unstable - nixpkgs.url = "github:NixOS/nixpkgs?rev=75e28c029ef2605f9841e0baa335d70065fe7ae2"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/tests/default.nix b/tests/default.nix index 761ea79fe..43595308f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -13,10 +13,6 @@ in let pkgs' = pkgs // { inherit poetry2nix; - - # At the time of writing 3.12 is causing issues. - python3 = pkgs.python311; - python = pkgs.python311; }; poetry2nix = import ./.. { pkgs = pkgs'; };