diff --git a/pkgs/development/python-modules/bootstrap/build/default.nix b/pkgs/development/python-modules/bootstrap/build/default.nix new file mode 100644 index 000000000000..639d2e3292cb --- /dev/null +++ b/pkgs/development/python-modules/bootstrap/build/default.nix @@ -0,0 +1,49 @@ +{ lib +, stdenv +, python +, build +, flit-core +, installer +, packaging +, pyproject-hooks +, tomli +}: +let + buildBootstrapPythonModule = basePackage: attrs: stdenv.mkDerivation ({ + pname = "${python.libPrefix}-bootstrap-${basePackage.pname}"; + inherit (basePackage) version src meta; + + buildPhase = '' + runHook preBuild + + PYTHONPATH="${flit-core}/${python.sitePackages}" \ + ${python.interpreter} -m flit_core.wheel + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + PYTHONPATH="${installer}/${python.sitePackages}" \ + ${python.interpreter} -m installer \ + --destdir "$out" --prefix "" dist/*.whl + + runHook postInstall + ''; + } // attrs); + + bootstrap-packaging = buildBootstrapPythonModule packaging {}; + + bootstrap-pyproject-hooks = buildBootstrapPythonModule pyproject-hooks {}; + + bootstrap-tomli = buildBootstrapPythonModule tomli {}; +in +buildBootstrapPythonModule build { + propagatedBuildInputs = [ + bootstrap-packaging + bootstrap-pyproject-hooks + ] ++ lib.optionals (python.pythonOlder "3.11") [ + bootstrap-tomli + ]; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a56e5ea05fc6..0a71e25ed68f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13,6 +13,9 @@ self: super: with self; { installer = toPythonModule (callPackage ../development/python-modules/bootstrap/installer { inherit (bootstrap) flit-core; }); + build = toPythonModule (callPackage ../development/python-modules/bootstrap/build { + inherit (bootstrap) flit-core installer; + }); }; bootstrapped-pip = toPythonModule (callPackage ../development/python-modules/bootstrapped-pip { });