---- On Tue, 04 Feb 2020 02:59:25 -0500 Tanguy Le Carrour <tan...@bioneland.org> wrote ---- > Hi, > > Le 02/02, sirgazil a écrit : > > I'm currently using two package managers when working on my projects > > written in Python. I use Guix to install Python, > > Depending on your OS, you can also use Pyenv [1][] to install what > ever version of Python you like. I haven't figured out how to package it > for Guix, though. > > [1]: https://github.com/pyenv/pyenv
I only mentioned Python here as something I install with the OS package manager, but I actually install other things that are not packaged for the language package manager. And I wanted to see if I can use Guix instead of several package managers. > > […] > > Emacs Elpy detects the virtual environments I create in this way, so I can > > activate and deactivate them from Emacs with an easy to use interface and > > have code completion that depends on the packages available in the active > > environment. > > > > I'd like to use Guix and its environments to replace this functionality and > > to make my development environments easier to reproduce, but I don't > > understand how to that exactly. > > > > So far I have tried the "guix environment" command as follows, trying to > > create a persistent environment I can activate/deactivate whenever I want: > > > > #+BEGIN_EXAMPLE > > $ guix environment --pure --manifest=guix.scm > > --root=/path/to/my-guix-envs/my-project > > #+END_EXAMPLE > > If you want to create a persistent environment, you should use a profile, > not the `environment` command. > There's a good cookbook entry for that [2][]. > > [2]: > https://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practice.html#Guix-Profiles-in-Practice I don't know how I missed this information. I'll take a look, thanks :) > > After running that command, I can see the prompt adds a "[env]" label > > indicating that I'm in the environment, and I can use the packages > > specified > > in the manifest file. But > > > > • How could one make the prompt add "[my-project]" instead of the generic > > "[env]"? > > I would say this depends on the shell you are using. If you are a Bash > user, you have to set the PS1 variable. If you use Fish [3][], you have to > set your > prompt in a config file: `~/.config/fish/functions/fish_prompt.fish` > and/or `~/.config/fish/functions/fish_right_prompt.fish`. Sorry, what I wanted to say is that I would expect that label to change automatically to "[my-project]" when I use the "--root" option. > > • Once I deactivate this environment (Ctrl+D), how can I activate it again? > > I personally use Direnv [4][] to manage this. Whenever I `cd` to a > project folder, it creates and/or activates the venv and deactivates it > when you `cd` out of it. > > [4]: https://github.com/direnv/direnv/wiki/Python > > > Using poetry + pyenv + direnv might be a bit confusing at first, but it's > really worth a try! I will give all that a try if Guix doesn't satisfy my needs. Thanks, Tanguy :)