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: Carlo Zancanaro
Subject: Re: consider setting the necessary environment variables
Date: Mon, 18 Mar 2024 06:31:53 +1100
User-agent: Gnus/5.13 (Gnus v5.13)

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.

Carlo



reply via email to

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