1 { lib, stdenv, python, makeWrapper, unzip
4 , wheel, pip, setuptools
7 stdenv.mkDerivation rec {
10 name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
12 srcs = [ wheel.src pip.src setuptools.src ];
15 dontUseSetuptoolsBuild = true;
16 dontUsePipInstall = true;
18 # Should be propagatedNativeBuildInputs
19 propagatedBuildInputs = [
20 # Override to remove dependencies to prevent infinite recursion.
21 (pipInstallHook.override{pip=null;})
22 (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
29 nativeBuildInputs = [ makeWrapper unzip ];
30 buildInputs = [ python ];
34 installPhase = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
35 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
37 # Give folders a known name
39 mv setuptools* setuptools
42 # - pip and setuptools need to be in PYTHONPATH to install setuptools, wheel, and pip.
43 # - $out is where we are installing to and takes precedence, and is where wheel will end so we can install pip.
44 export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$PYTHONPATH"
46 echo "Building setuptools wheel..."
48 ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
51 echo "Building wheel wheel..."
53 ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
56 echo "Building pip wheel..."
58 ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
63 description = "Version of pip used for bootstrapping";
64 license = lib.unique (pip.meta.license ++ setuptools.meta.license ++ wheel.meta.license);
65 homepage = pip.meta.homepage;