[bug#76082,0/9] Improve profile initialization on foreign distros plus misc improvements

Message ID cover.1738814583.git.liam@hpfr.net
Headers
Series Improve profile initialization on foreign distros plus misc improvements |

Message

Liam Hupfer Feb. 6, 2025, 4:07 a.m. UTC
  Hi Guix!  Hope those who attended enjoyed Guix Days and FOSDEM.  Looks
like the Whippet talk is the first recording from the DMC track to go
up!

This series modifies the /etc/profile.d/zzz-guix.sh deployed by
guix-install.sh (and tweaks Guix Home’s setup-environment script) to
make search path initialization a little more consistent based on my
experiences using Guix on NixOS and Ubuntu. Currently, new users tend to
end up with numerous duplicate search path entries, which can be
confusing when trying to grok profiles and search paths early on.

Ironically, NixOS and Ubuntu both ship “native” Guix packages.  I
figured I should start by improving the upstream installation script,
though, since it tends to inspire foreign distros’ Guix package recipes.
While I’m here, I did some general tidying as well.

The most contentious change is the removal of any attempt to initialize
Guix Home from /etc/profile.d/.  The rationale here is that Guix Home
has more in common with Guix System than the ‘guix pull’ and default
imperative user profiles.  Guix Home can do arbitrary things at profile
initialization.  It initializes itself in ~/.profile by default and
documents shell configuration to source ~.profile if the user doesn’t
also manage their shell with Guix Home.  Since Guix Home can manage
itself, we can keep it self-contained rather than trying to keep
/etc/profile.d/zzz-guix.sh in lockstep with Guix Home’s dedicated
initialization code.

I tested the updated install script in a Debian container via Incus (LXD
successor) and the updates to Guix Home via ‘./pre-inst-env guix home
container home-test.scm’ with a small home environment.  Additional
testing is appreciated, of course!

Along with the Guix Home team, Vagrant is Cc’d since these changes may
inform changes to the Debian package (thank you for developing it,
btw!).  I help maintain the NixOS module and plan to update it
accordingly once these changes make it through review.

Thanks!

Liam Hupfer (9):
  home: services: setup-environment: Use GUIX_PROFILE.
  home: services: Unset variables after profile init.
  home: services: setup-environment: Set GUIX_LOCPATH.
  guix-install.sh: Remove system-level Guix Home initialization.
  guix-install.sh: Improve Guix profile sourcing.
  guix-install.sh: Add to MANPATH.
  guix-install.sh: Appease shellcheck.
  guix-install.sh: Add msg helpers and use stderr consistently.
  guix-install.sh: Check for existing installation before downloading.

 etc/guix-install.sh          | 264 ++++++++++++++++++++---------------
 gnu/home/services.scm        |  32 +++--
 gnu/home/services/shells.scm |   3 +-
 3 files changed, 171 insertions(+), 128 deletions(-)


base-commit: 52c05f3b120e641c8bd2d68cfcf0d6af947de27b
  

Comments

Ludovic Courtès Feb. 21, 2025, 1:46 p.m. UTC | #1
Hi Liam,

Liam Hupfer <liam@hpfr.net> skribis:

> Hi Guix!  Hope those who attended enjoyed Guix Days and FOSDEM.  Looks
> like the Whippet talk is the first recording from the DMC track to go
> up!

:-)  Good time in Brussels!

>   home: services: setup-environment: Use GUIX_PROFILE.
>   home: services: Unset variables after profile init.
>   home: services: setup-environment: Set GUIX_LOCPATH.
>   guix-install.sh: Remove system-level Guix Home initialization.
>   guix-install.sh: Improve Guix profile sourcing.
>   guix-install.sh: Add to MANPATH.
>   guix-install.sh: Appease shellcheck.
>   guix-install.sh: Add msg helpers and use stderr consistently.
>   guix-install.sh: Check for existing installation before downloading.

This all looks reasonable and largely safe to me to I went ahead and
applied it.

Everyone else: please speak up if you think something needs to be
adjusted or discussed.

Thanks!

Ludo’.
  
Liam Hupfer Feb. 22, 2025, 8:51 p.m. UTC | #2
Hi Ludo!

Ludovic Courtès <ludo@gnu.org> writes:

> This all looks reasonable and largely safe to me to I went ahead and
> applied it.
>
> Everyone else: please speak up if you think something needs to be
> adjusted or discussed.

Glad to hear it! I’m a little apprehensive without others’ feedback
since the install script is particularly difficult to test considering
the heterogeneous environments where it can be used, but we can see what
crops up now that it’s live.

Also, I realized I forgot the copyright lines 🤦. I sent a [follow-up
patch] to the bug.

> Thanks!

Thank you!

—Liam


[follow-up
patch] <https://yhetil.org/guix-patches/05f77325a8e56a88f92480b3e17712d4000fc910.1740256618.git.liam@hpfr.net/>