Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, python 4, build 5, flit-core 6, installer 7, packaging 8, pyproject-hooks 9, tomli 10}: 11let 12 buildBootstrapPythonModule = basePackage: attrs: stdenv.mkDerivation ({ 13 pname = "${python.libPrefix}-bootstrap-${basePackage.pname}"; 14 inherit (basePackage) version src meta; 15 16 buildPhase = '' 17 runHook preBuild 18 19 PYTHONPATH="${flit-core}/${python.sitePackages}" \ 20 ${python.interpreter} -m flit_core.wheel 21 22 runHook postBuild 23 ''; 24 25 installPhase = '' 26 runHook preInstall 27 28 PYTHONPATH="${installer}/${python.sitePackages}" \ 29 ${python.interpreter} -m installer \ 30 --destdir "$out" --prefix "" dist/*.whl 31 32 runHook postInstall 33 ''; 34 } // attrs); 35 36 bootstrap-packaging = buildBootstrapPythonModule packaging {}; 37 38 bootstrap-pyproject-hooks = buildBootstrapPythonModule pyproject-hooks {}; 39 40 bootstrap-tomli = buildBootstrapPythonModule tomli {}; 41in 42buildBootstrapPythonModule build { 43 propagatedBuildInputs = [ 44 bootstrap-packaging 45 bootstrap-pyproject-hooks 46 ] ++ lib.optionals (python.pythonOlder "3.11") [ 47 bootstrap-tomli 48 ]; 49}