Created
June 26, 2020 08:56
-
-
Save kidmose/a9dc26ff1bb0fcdbefe09e56a892923a to your computer and use it in GitHub Desktop.
Nix shell for python with mutable python modules (I.e. `pip install ...` works like in a virtualenv`)
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
with import <nixpkgs> {}; | |
let | |
python = pkgs.python38.buildEnv.override { | |
# throw in some default stuff that is always nice to have | |
extraLibs = with pkgs.python38Packages; [ | |
numpy | |
ipython | |
jupyter | |
pandas | |
]; | |
}; | |
in | |
pkgs.mkShell { | |
buildInputs = with pkgs; with python.pkgs; [ | |
pip | |
setuptools | |
]; | |
shellHook = '' | |
alias pip="PIP_PREFIX='$(pwd)/_build/pip_packages' \pip" | |
export PYTHONPATH="$(pwd)/_build/pip_packages/lib/${python.executable}/site-packages:$PYTHONPATH" | |
export PATH="$(pwd)/_build/pip_packages/bin:$PATH" | |
unset SOURCE_DATE_EPOCH | |
''; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment