mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 14:47:06 +00:00
56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
{ stdenv, python, fetchPypi, makeWrapper, unzip }:
|
|
|
|
let
|
|
wheel_source = fetchPypi {
|
|
pname = "wheel";
|
|
version = "0.32.1";
|
|
format = "wheel";
|
|
sha256 = "15hizylh761jcaz8zfdc3wg30jf33izaakyv1p82ppx2y5rgg8cz";
|
|
};
|
|
setuptools_source = fetchPypi {
|
|
pname = "setuptools";
|
|
version = "40.4.3";
|
|
format = "wheel";
|
|
sha256 = "1zzryv1fqx4nk7hzv4afxpl8k7f60lc0qkhxlc8sqjs4igakfhff";
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
pname = "pip";
|
|
version = "18.1";
|
|
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
format = "wheel";
|
|
sha256 = "7909d0a0932e88ea53a7014dfd14522ffef91a464daaaf5c573343852ef98550";
|
|
};
|
|
|
|
unpackPhase = ''
|
|
mkdir -p $out/${python.sitePackages}
|
|
unzip -d $out/${python.sitePackages} $src
|
|
unzip -d $out/${python.sitePackages} ${setuptools_source}
|
|
unzip -d $out/${python.sitePackages} ${wheel_source}
|
|
'';
|
|
|
|
patchPhase = ''
|
|
mkdir -p $out/bin
|
|
'';
|
|
|
|
nativeBuildInputs = [ makeWrapper unzip ];
|
|
buildInputs = [ python ];
|
|
|
|
installPhase = ''
|
|
|
|
# install pip binary
|
|
echo '#!${python.interpreter}' > $out/bin/pip
|
|
echo 'import sys;from pip._internal import main' >> $out/bin/pip
|
|
echo 'sys.exit(main())' >> $out/bin/pip
|
|
chmod +x $out/bin/pip
|
|
|
|
# wrap binaries with PYTHONPATH
|
|
for f in $out/bin/*; do
|
|
wrapProgram $f --prefix PYTHONPATH ":" $out/${python.sitePackages}/
|
|
done
|
|
'';
|
|
}
|