Last active
March 26, 2020 22:02
-
-
Save nyarly/12c9dda468ae801cb6fe87a120f7c51a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generated using pypi2nix tool (version: 1.8.1) | |
# See more at: https://github.com/garbas/pypi2nix | |
# | |
# COMMAND: | |
# pypi2nix -V 2.7 | |
# | |
{ pkgs ? import <nixpkgs> {} | |
}: | |
let | |
inherit (pkgs) makeWrapper; | |
inherit (pkgs.stdenv.lib) fix' extends inNixShell; | |
pythonPackages = | |
import "${toString pkgs.path}/pkgs/top-level/python-packages.nix" { | |
inherit pkgs; | |
inherit (pkgs) stdenv; | |
python = pkgs.python27Full; | |
# patching pip so it does not try to remove files when running nix-shell | |
overrides = | |
self: super: { | |
bootstrapped-pip = super.bootstrapped-pip.overrideDerivation (old: { | |
patchPhase = old.patchPhase + '' | |
sed -i -e "s|paths_to_remove.remove(auto_confirm)|#paths_to_remove.remove(auto_confirm)|" -e "s|self.uninstalled = paths_to_remove|#self.uninstalled = paths_to_remove|" $out/${pkgs.python35.sitePackages}/pip/req/req_install.py | |
''; | |
}); | |
}; | |
}; | |
commonBuildInputs = []; | |
commonDoCheck = false; | |
withPackages = pkgs': | |
let | |
pkgs = builtins.removeAttrs pkgs' ["__unfix__"]; | |
interpreter = pythonPackages.buildPythonPackage { | |
name = "python27Full-interpreter"; | |
buildInputs = [ makeWrapper ] ++ (builtins.attrValues pkgs); | |
buildCommand = '' | |
mkdir -p $out/bin | |
ln -s ${pythonPackages.python.interpreter} $out/bin/${pythonPackages.python.executable} | |
for dep in ${builtins.concatStringsSep " " (builtins.attrValues pkgs)}; do | |
if [ -d "$dep/bin" ]; then | |
for prog in "$dep/bin/"*; do | |
if [ -f $prog ]; then | |
ln -s $prog $out/bin/`basename $prog` | |
fi | |
done | |
fi | |
done | |
for prog in "$out/bin/"*; do | |
wrapProgram "$prog" --prefix PYTHONPATH : "$PYTHONPATH" | |
done | |
pushd $out/bin | |
ln -s ${pythonPackages.python.executable} python | |
ln -s ${pythonPackages.python.executable} python2 | |
popd | |
''; | |
passthru.interpreter = pythonPackages.python; | |
}; | |
in { | |
__old = pythonPackages; | |
inherit interpreter; | |
mkDerivation = pythonPackages.buildPythonPackage; | |
packages = pkgs; | |
overrideDerivation = drv: f: | |
pythonPackages.buildPythonPackage (drv.drvAttrs // f drv.drvAttrs // { meta = drv.meta; }); | |
withPackages = pkgs'': | |
withPackages (pkgs // pkgs''); | |
}; | |
python = withPackages {}; | |
generated = self: { | |
}; | |
localOverridesFile = ./requirements_override.nix; | |
overrides = import localOverridesFile { inherit pkgs python; }; | |
commonOverrides = [ | |
]; | |
allOverrides = | |
(if (builtins.pathExists localOverridesFile) | |
then [overrides] else [] ) ++ commonOverrides; | |
in python.withPackages | |
(fix' (pkgs.lib.fold | |
extends | |
generated | |
allOverrides | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
let | |
# inspired by https://github.com/nix-community/pypi2nix#id17 | |
python = import ./requirements.nix { inherit pkgs; }; | |
in | |
python.interpreter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment