[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I replace Python venv and pip with Guix?

From: mlell
Subject: Re: How can I replace Python venv and pip with Guix?
Date: Tue, 04 Feb 2020 15:31:07 +0100
User-agent: Posteo Webmail

Hi sirgazil,

Well, the profile is created and persists, but, after deactivating the
environment, how do I start an environment that uses that profile?

If you want to use the isolation features of `guix environment`, like running inside a container, you can just use the same command that you used for creating the profile. Guix will not rebuild anything because all derivations are already in the store from the first time you executed this,

guix environment --pure --manifest=guix.scm --root=/path/to/my-guix-envs/my-project

Otherwise, you can use the standard way that you can use to load any GUIX profile: You source
the <profile>/etc/profile file into your shell:

GUIX_PROFILE="/path/to/my-guix-envs/my-project"; . "$GUIX_PROFILE"/etc/profile

The dot is the shell command `source`. It defines the nessecary environment variables like PATH. Defining the variable GUIX_PROFILE has the effect thatyou always access the newest generation of the profile. If you update your profile while your shell is running, you automatically access the files of the new generation. Read the source code of $GUIX_PROFILE/etc/profile for more info.

As a general note, the use case of `guix environment` is to debug how a specific program is built by GUIX. For example, if you want to enter the environment that GUIX creates for the building of GNU hello, you call `guix environment hello`. You enter a profile with the *dependencies* of hello which you can then try to build yourself. If you just want to create a profile following a manifest
file, just use

guix package --manifest="your-manifest.scm" -p /path/to/profile-folder

That said, the containerization features of `guix environment` can be handy in other cases, too.

Cheers, Moritz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]