Le 29 septembre 2021 09:10:44 GMT-04:00, Kenan Toker <[email protected]> a écrit : >Hello wonderful Guix users and developers! > >I am looking for some help understanding fundamental concepts in Guix. >In particular, I want to better understand how $GUIX_PROFILE works, and >how profiles are sourced when I boot, login, etc. I am using Guix System >and generally keep up-to-date with the main branch, usually running a >guix pull every other day before I make any configuration changes or >install new packages. > >I have recently started using guix home, and my $GUIX_PROFILE is >automatically set to: > ~/.guix-home/profile >This is currently a symlink to the directory: > /gnu/store/708xnkkd86xf4nx9mmf8szpwi4yd9ms2-profile/ > >I also have a symlink in my $HOME called ~/.guix-profile, which links to: > /var/guix/profiles/per-user/me/guix-profile >This links to the symlink: > /var/guix/profiles/per-user/me/guix-profile-n-link >Which in turn currently links to the directory: > /gnu/store/3mjlciy8fywyvajcxy76gy3dscp1bmns-profile/ > >What I am wondering is: > 1. Where is $GUIX_PROFILE set for my user, and how has this changed >since using guix home? > 2. ~/.guix-profile/etc/profile seems to have been sourced at some >point between booting, logging into my account, and opening an >interative shell, because all my packages are present when I run `guix >package -I`; I also have all the packages I expect in Gnome Shell. >How/when was ~/.guix-profile/etc/profile sourced if it is not set to >$GUIX_PROFILE? > >Slightly related: before I started using guix home, I found that my >$GUIX_PROFILE would sometimes be set to ~/.config/guix/current, which >links to: > /var/guix/profiles/per-user/me/current-guix >This links to the symlink: > /var/guix/profiles/per-user/me/current-guix-n-link >Which in turn currently links to the directory: > /gnu/store/n6syypzqx7cfr7ypd56ww04313xh888k-profile/ > >(This behaviour, where $GUIX_PROFILE was ~/.config/guix/current instead >of ~/.guix-profile, did not always happen - I have never found a clear >pattern as to why it happened when it did. I did find that it would >correlate with unexpected behaviour like my laptop not suspending on lid >close, but I have never determined the exact cause of this so it might >not be related.) > >I understand that ~/.config/guix/current is a profile containing the >current version of Guix (along with the channels I use), and that >~/.guix-profile is a profile containing packages installed to the >default profile. On this, I am wondering > 1. How it is that both ~/.config/guix/current/etc/profile and >~/.guix-profile/etc/profile are sourced at some point before or during >login? > 2. Why it was that $GUIX_PROFILE would sometimes be set to >~/.config/guix/current (before I started using guix home)? > >Thanks a lot everyone, >Kenan >
GUIX_PROFILE is not used by guix ittelf, it's only a convenience variable that's set just before sourcing said profile. On a foreign distro, you'll find the code that loads your profile in /etc/profile.d/guix.sh On the guix system, it's /etc/profile directly. In addition, you might have some code in ~/.profile or ~/.bash_profile. As you can see, GUIX_PROFILE's value changes multiple times, which explains why multiple profiles are loaded in the environment.
