I think you're looking for guix environment --ad-hoc
. For example:
guix environment --ad-hoc python python-pandas
That creates a temporary Guix profile with Python and Pandas installed, but could equally be any other packages in Guix. Specifically with Python you need to include python
so that it is aware of python-pandas
. The above gives you a temporary profile that still has access to exsting environment variables and packages in the current user and system profiles.
For a more isolated (and hence reproducible) environment, you can use --pure
to hide existing environment variables, user profile and system profile:
guix environment --pure --ad-hoc [packages]
For full containerized isolation, which alows you to restrict filesystem and network access:
guix environment --container --ad-hoc [packages]
The last two options will require you to explicitly specify a whole lot of the more fundamental packages, such as coreutils
; more effort, but more reproducible.
See invoking guix environment for more.
I also use a program called direnv
which automatically activates/deactivates these profiles and other environment variables for various projects. You create a .envrc
file for your project something like this:
use guix --ad-hoc python python-matplotlib python-html5lib python-mypy python-flake8
source ~/.virtualenvs/base-django-py38/bin/activate
export DJANGO_SETTINGS_MODULE=project.settings.dev
The use guix
is a custom feature of direnv, which is only briefly documented.