Installing streisand on nixos (issue with virtualenv)

Hi, I am trying to install (deploy) streisand vpn from my nixos. I think I have all the dependencies required, when I run
./util/venv-dependencies.sh ./venv from second step it gives following error.

Collecting virtualenv
  Using cached https://files.pythonhosted.org/packages/62/77/6a86ef945ad39aae34aed4cc1ae4a2f941b9870917a974ed7c5b6f137188/virtualenv-16.7.8-py2.py3-none-any.whl
Installing collected packages: virtualenv
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/nix/store/ry7pmp6qc5r3gl7dk3ha3swyankv2hx2-python-2.7.17/lib/python2.7/site-packages/virtualenv.pyc'

this is my relative configuration:
https://hastebin.com/enafudexad.bash

my experience with nixos is 2 days tbh, any help is appreciated :slight_smile:

actually, I see that installation of any python module is failing.
similar error:

 △ ~ python2.7 -m ensurepip --default-pip
Looking in links: /tmp/tmpn4x8lQ
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/nix/store/ry7pmp6qc5r3gl7dk3ha3swyankv2hx2-python-2.7.17/lib/python2.7/site-packages/easy_install.pyc'

python is finding an old version of the package in your environment. (This is intended, nixpkgs will put python packages on PYTHONPATH, and pip will find the packages through this).

What you probably want is a venv for pip to do what it wants, for this I would do something like:

# shell.nix
let
  pkgs = import <nixpkgs> {};
  python = pkgs.python37;
  pythonPackages = python.pkgs;
in
with pkgs;

mkShell {
  name = "pip-env";
  buildInputs = with pythonPackages; [
    # System requirements.
    readline
    pandas
    virtualenvwrapper

    # needed for buildilng certain packages
    libffi
    openssl
    gcc
  ];
  src = null;
  shellHook = ''
    # Allow the use of wheels.
    SOURCE_DATE_EPOCH=$(date +%s)
    # Augment the dynamic linker path
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.ncurses}/lib
    VENV=venv
    if test ! -d $VENV; then
      virtualenv $VENV
    fi
    source ./$VENV/bin/activate
    export PYTHONPATH=`pwd`/$VENV/${python.sitePackages}/:$PYTHONPATH
  '';
}

then your workflow would be:

$ nix-shell
$ ./util/venv-dependencies.sh ./venv
1 Like