How to work with/around virtualenv created by an Ubuntu VM?

I’m working on a Python project with several other developers. The target platform is Ubuntu. To make it possible for developers to work on the platform of their choice we’ve taken the approach of running all the development commands in an LXD container (using Vagrant). The services themselves run in Docker containers. Because the Docker daemon is running outside the LXD container, we’re able to inspect running services without having to go through two container layers. This is working really well for us, in that new developers are able to start developing quickly by running a single command in the repo.

The Python virtualenvs are created within the relevant container using pipenv and mounted from the outside, so that IDEs can reach them to allow auto-complete, syntax checking and other features. Unfortunately, NixOS is sufficiently different from Ubuntu and Arch Linux that JetBrains IDEA can no longer understand the virtualenv contents, presumably because all the system libraries are in different places.

What would be a sensible way to work around this? So far I’ve tried the following approaches:

  1. Link directly to the virtualenv python like I did on Arch Linux. This results in

    Cannot set up a python SDK at Python 2.7 (DMS) ([…]/.venv/bin/python).The SDK seems invalid." even though the SDK is Python 3.6.

    and

    Probably SDK installed in ‘[…]/.venv/bin/python’ is corrupt

  2. Link to the module pipenv. This breaks in two ways. First, it removes the original .venv directory and then fails to create the new one. Second, when running /run/current-system/sw/bin/pipenv --python /run/current-system/sw/bin/python install --dev it fails:

    FileNotFoundError: [Errno 2] No such file or directory: ‘[…]/.venv/.project’

  3. A separate script which builds duplicate virtualenvs using the host python, which should then be trivial to link into the IDE. That runs into a libffi issue. This approach is not ideal, because installing all the dependencies twice is time-consuming and I don’t want to have a different development environment to my colleagues.

  4. Link via Vagrant. This requires an SSH configuration workaround, and is probably not the most efficient. Currently it works, though, as opposed to all the other things I’ve tried.

I expect the canonical answer will involve a Nix expression, but I don’t know what that would even look like. Would I wrap IDEA? Wrap the Ubuntu-built binaries?