as of now, swh-environment within nix:
```
$ nix-shell swh.nix
```
The first time, nix will install all the necessary runtime tools.
Then create a new virtualenv "swh".
Then install the necessary swh tools.
Next time, it will connect to the virtualenv.
with $SWH_ENVIRONMENT_HOME/swh.nix as:
```
with import <nixpkgs> {};
let ppackages = pkgs.python3Packages;
in stdenv.mkDerivation {
name = "swhEnv";
buildInputs = [
# required packages for virtualenvwrapper and pip to work
# python3Full
# ppackages.virtualenv
ppackages.virtualenvwrapper
ppackages.ipython
# runtime dependencies needed for the python modules pip will try
# to install. In this particular environment the python modules
# listed in the accumulated requirements.txt require the following
# packages to be installed locally in order to compile any binary
# extensions they may require.
openssl
libffi
libzip
stdenv
zlib
pkgs.docker
pkgs.systemd.lib systemd
# subvertpy needs this
apr aprutil pkgs.subversion.dev
# web (not enough)
pkgs.libxml2 python3Packages.lxml
postgresql_11
];
src = null;
shellHook =''
# set SOURCE_DATE_EPOCH so that we can use python wheels
SOURCE_DATE_EPOCH=$(date +%s)
source ${ppackages.virtualenvwrapper}/bin/virtualenvwrapper.sh
export ENV_NAME=swh
export ENV_FOLDER=$HOME/.virtualenvs/$ENV_NAME/
install-or-update-env() {
echo "($ENV_NAME) $ENV_FOLDER: Install tools..."
pip install pytest tox pifpaf flake8 codespell pre-commit pdbpp
# no need if we are using mainly tox
# echo "($ENV_NAME) $ENV_FOLDER: Install pip swh packages..."
# pip install $( ./bin/pip-swh-packages --with-testing )
}
if [ ! -d $ENV_FOLDER ]; then
# export LC_ALL=C.UTF-8
# export LC_CTYPE=C.UTF-8
# export LANG=C.UTF-8
# subvertpy needs this for compilation
export SVN_PREFIX=${pkgs.subversion.dev}
# libsystemd need this
export PKG_CONFIG_PATH=${pkgs.systemd.lib}/lib
echo "Creating virtualenv $ENV_NAME at $ENV_FOLDER"
mkvirtualenv -p ${python3}/bin/python -a $SWH_ENVIRONMENT_HOME $ENV_NAME
install_or_update_env
echo "Creating virtualenv $ENV_NAME at $ENV_FOLDER. Done."
else
echo "Connecting to virtualenv $ENV_NAME at $ENV_FOLDER"
workon $ENV_NAME
fi
'';
}
Then to update the environment from within
```
(swh) $ install-or-update-env
```