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

From: Liam Hupfer <[email-masked]>
Date: Wed, 5 Feb 2025 22:07:20 -0600

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
-- 
2.47.1