Apache mod wsgi with custom python2 packages

Hello All,
I’m trying to setup Apache vhost that uses mod_wsgi with python27 with specific list of python packages all comming from nixpkgs. The desired nix-shell default.nix with a python27 environment (packages) is below. I know that the package


is using the default pyhon2 but I can’t seem to figure out how to use overlays to make mod_wsgi to use the python27 environment as specified in default.nix.

In the services.httpd... vhost, referencing the wsgi module via extraModules works fine. But is using the python2 package without any site-packages installed.

extraModules = [{ name = "wsgi"; path = "${pkgs.apacheHttpdPackages.\|      extraLibs = with python27Packages; [
mod_wsgi}}/modules/mod_wsgi.so"; }]; 

Would anybody know how to proceed? Thanks a lot.

The default.nix mentioned above that works in nix-shell is here. Note that ignoreCollisions = true;

with import <nixpkgs> {};
stdenv.mkDerivation rec {
  name = "pjbrefct";

  # Mandatory boilerplate for buildable env
  env = buildEnv { name = name; paths = buildInputs; };
  builder = builtins.toFile "builder.sh" ''
    source $stdenv/setup; ln -s $env $out

  # Customizable development requirements
  buildInputs = [
    # Add packages from nix-env -qaP | grep -i needle queries

    # With Python configuration requiring a special wrapper
    (python27.buildEnv.override {
      ignoreCollisions = true;
      extraLibs = with python27Packages; [
        # Add pythonPackages without the prefix
        Babel chardet decorator docutils feedparser gevent greenlet html2text jinja2 libsass lxml Mako markupsafe mock  ofxparse passlib pillow psutil psycopg2 pydot  pyparsing pypdf2 pyserial python-dateutil pytz pyusb qrcode reportlab requests suds-jurko vobject werkzeug xlwt xlrd simplejson pychart unittest2 pycountry numpy unicodecsv  matplotlib pyyaml openidc-client

  # Customizable development shell setup with at last SSL certs set
  #shellHook = ''
  #  export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt

My system:

- system: `"x86_64-linux"`
 - host os: `Linux 4.19.72, NixOS, 19.03.git.2dfae8e (Koi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.2.2`
 - channels(root): `"nixos-19.03.173506.2dfae8e22fd"`
 - channels(jan): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`