help-guix
[Top][All Lists]
Advanced

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

Re: consider setting the necessary environment variables


From: Thomas Bennett
Subject: Re: consider setting the necessary environment variables
Date: Mon, 13 May 2024 17:04:21 +0200
User-agent: Mozilla Thunderbird

Hello Carlo,

Well after a while, I finally manage to take the time to deal with that issue.

And... thank you very much! Indeed, I had only one profile set instead of two.

I added the second and everything works like a charm.

On 2024-03-17 20:31, Carlo Zancanaro wrote:
Hi Thomas,

On Sun, Mar 17 2024, Thomas Bennett wrote:
I have an issue where my root user seems to be unable to have its
environment set.
That sounds annoying! Hopefully we can figure out what's going wrong for
you. 🙂

# tail /root/.bashrc
[...]

GUIX_PROFILE="/root/.config/guix/current"
. "$GUIX_PROFILE/etc/profile"
This sets the GUIX_PROFILE variable to the current Guix profile. This
adds the "guix" command to your PATH, but not any of your installed
packages.

There are two main profiles that you need to source. One if the current
Guix profile, in $HOME/.config/guix/current, and the other is your
user's package profile, in $HOME/.guix-profile.

The former is suggested when you run "guix pull", and the latter is
suggested when you run "guix package" commands (including shorthands
like "guix install"). We can see this in your output:

root@brain ~# guix package -i bat
[...]
hint: Consider setting the necessary environment variables by running:

     GUIX_PROFILE="/root/.guix-profile
     . "$GUIX_PROFILE/etc/profile"

Alternately, see `guix package --search-paths -p "/root/.guix-profile"'.
You mention:

I tried to manually source "$GUIX_PROFILE/etc/profile" but it's no
better.
but it's not clear whether you set GUIX_PROFILE to /root/.guix-profile
before doing so.

Can you try using this as your Guix initialisation code in your shell?

--8<---------------cut here---------------start------------->8---
GUIX_PROFILE="$HOME/.guix-profile"
. "$GUIX_PROFILE/etc/profile"
GUIX_PROFILE="$HOME/.config/guix/current"
. "$GUIX_PROFILE/etc/profile"
unset GUIX_PROFILE
--8<---------------cut here---------------end--------------->8---

As an additional gotcha that might cause problems for you in future: the
usual advice in Guix is to source your profiles in .bash_profile rather
than .bashrc.  This allows "guix shell" to source .bashrc in a --pure
environment without also including your entire user profile.
I moved the profiles configurations in~/.bash_profile as you mentionned and removed it from ~/.bashrc, thank for that as well.

Your help was precious.

Best,
Thomas

Carlo


reply via email to

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