Skip to content

Instantly share code, notes, and snippets.

@arskiy
Last active April 4, 2020 19:25
Show Gist options
  • Save arskiy/8817786be9186ee52684978a60838917 to your computer and use it in GitHub Desktop.
Save arskiy/8817786be9186ee52684978a60838917 to your computer and use it in GitHub Desktop.
creates a working impure python env in nixos. replace <packages> with the packages you want.
with import <nixpkgs> {};
with pkgs.python27Packages;
stdenv.mkDerivation {
name = "impurePythonEnv";
buildInputs = [
automake
autoconf
gcc-arm-embedded-7
# these packages are required for virtualenv and pip to work:
#
python3
python3Packages.virtualenv
python3Packages.pip
python3Packages.numpy
python3Packages.setuptools
python3Packages.pandas
taglib
openssl
git
stdenv
zlib ];
src = null;
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
# the following is required to build micro_ecc_lib_nrf52.a in the SDK
export GNU_INSTALL_ROOT="${gcc-arm-embedded-7}/bin/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${stdenv.cc.cc.lib}/lib/libstdc++.so.6"
pip install <packages>
unset CC
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment