Skip to content

Instantly share code, notes, and snippets.

@AshyIsMe
Last active November 22, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshyIsMe/aed9399d6290deb9be47fca01cf269d7 to your computer and use it in GitHub Desktop.
Save AshyIsMe/aed9399d6290deb9be47fca01cf269d7 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
with python27Packages;
stdenv.mkDerivation {
name = "impurePythonEnv";
src = null;
buildInputs = [
# these packages are required for virtualenv and pip to work:
#
python27Full
python27Packages.virtualenv
python27Packages.pip
# the following packages are related to the dependencies of your python
# project.
# In this particular example the python modules listed in the
# requirements.txt require the following packages to be installed locally
# in order to compile any binary extensions they may require.
#
taglib
openssl
git
libxml2
libxslt
libzip
stdenv
zlib
];
shellHook = ''
# set SOURCE_DATE_EPOCH so that we can use python wheels
SOURCE_DATE_EPOCH=$(date +%s)
virtualenv --no-setuptools venv
export PATH=$PWD/venv/bin:$PATH
pip install -r requirements.txt
'';
}
$ nix-shell
these paths will be fetched (0.03 MiB download, 0.16 MiB unpacked):
/nix/store/2h5kilbwjpjs72w7k0y7j4b1yd343j6k-libxslt-1.1.33-py
copying path '/nix/store/2h5kilbwjpjs72w7k0y7j4b1yd343j6k-libxslt-1.1.33-py' from 'https://cache.nixos.org'...
New python executable in /home/aaron/codebases/solokeys/venv/bin/python2.7
Also creating executable in /home/aaron/codebases/solokeys/venv/bin/python
Installing pip, wheel...
done.
Traceback (most recent call last):
File "/home/aaron/codebases/solokeys/venv/bin/pip", line 6, in <module>
from pip._internal.main import main
ImportError: No module named main
[nix-shell:~/codebases/solokeys]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment