Subject: bug#40872: First installed package on guix system is not instantly usable

From: Marius Bakke <[email-masked]>
Date: Sat, 02 May 2020 16:20:12 +0200

Stefan <[email-masked]> writes:

> Hi Marius!
>
>> This is odd, as /etc/profile contains a workaround for this exact
>> problem (notice the else clause):
>> 
>> # Arrange so that ~/.config/guix/current comes first.
>> for profile in "$HOME/.guix-profile" "$HOME/.config/guix/current"
>> do
>>  if [ -f "$profile/etc/profile" ]
>>  then
>>    # Load the user profile's settings.
>>    GUIX_PROFILE="$profile" ; \
>>    . "$profile/etc/profile"
>>  else
>>    # At least define this one so that basic things just work
>>    # when the user installs their first package.
>>    export PATH="$profile/bin:$PATH"
>>  fi
>> done
>> 
>> Can you investigate why this is ineffective on your system?
>
> Previously I had some packages installed, but I rolled-back to generation 0. I found this in my scroll-back buffer:
>
> stefan@guix ~/development/guix$ guix package --roll-back
> Folgende Ableitung wird erstellt:
>    /gnu/store/l0n6l104ldj7nz6kdyi7l8v5yjnc9p9g-profile.drv
> building profile with 0 packages...
> Von Generation „1“ zu „0“ gewechselt
>
> By rolling back it created a new generation 0 profile which is now lying around with this kind of empty file: 
>
> stefan@guix ~$ cat .guix-profile/etc/profile 
> # Source this file to define all the relevant environment variables in Bash
> # for this profile.  You may want to define the 'GUIX_PROFILE' environment
> # variable to point to the "visible" name of the profile, like this:
> #
> #  GUIX_PROFILE=/path/to/profile ; \
> #  source /path/to/profile/etc/profile
> #
> # When GUIX_PROFILE is undefined, the various environment variables refer
> # to this specific profile generation.
>
> So the test for the existence of this file does not fail, but it doesn't change PATH either. This is the profile content, it has no bin/ folder to add to PATH:

I see.  We could extend the test in /etc/profile to look for a /bin
directory of the profile, but arguably rolling back to generation 0 is
not a very common case.  So I'm in favor of just keeping the status quo.

WDYT?