GNU bug report logs - #77527
[PATCH v4 5/6] guix-install.sh: Group profile sourcing.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Fri, 4 Apr 2025 03:24:07 UTC

Severity: normal

Tags: patch

Merged with 77035, 77522, 77523, 77524, 77525, 77526, 77528

To reply to this bug, email your comments to 77527 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77527; Package guix-patches. (Fri, 04 Apr 2025 03:24:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 04 Apr 2025 03:24:08 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v4 5/6] guix-install.sh: Group profile sourcing.
Date: Fri,  4 Apr 2025 11:23:02 +0800
* etc/guix-install.sh (sys_create_init_profile): Group sourcing of all default
profiles.

Change-Id: Ia443b78a5ba656b7d03e1abbba53c4bf1240e338
---
 etc/guix-install.sh | 69 +++++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 31 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index b5d833cd64..f0d37bc384 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -749,47 +749,54 @@ export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}"
 export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
 # no default for XDG_RUNTIME_DIR (depends on foreign distro for semantics)
 
-# `guix pull` profile
-GUIX_PROFILE="$HOME/.config/guix/current"
-export PATH="$GUIX_PROFILE/bin${PATH:+:}$PATH"
-# Add to INFOPATH and MANPATH so the latest Guix documentation is available to
-# info and man readers.  When INFOPATH is unset, add a trailing colon so Emacs
-# searches 'Info-default-directory-list'.  When MANPATH is unset, add a
-# trailing colon so the system default search path is used.
-export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH"
-export MANPATH="$GUIX_PROFILE/share/man:$MANPATH"
-# Expose the latest Guix modules to Guile so guix shell and repls spawned by
-# e.g. Geiser work out of the box.
-export GUILE_LOAD_PATH="$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
-export GUILE_LOAD_COMPILED_PATH="$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
-
-# User's default profile, if it exists
-GUIX_PROFILE="$HOME/.guix-profile"
-if [ -L "$GUIX_PROFILE" ]; then
-  . "$GUIX_PROFILE/etc/profile"
-
-  # see info '(guix) Application Setup'
-  export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH"
-
-  # Documentation search paths may be handled by $GUIX_PROFILE/etc/profile if
-  # the user installs info and man readers via Guix.  If the user doesn’t,
-  # explicitly add to them so documentation for software from ‘guix install’
-  # is available to the system info and man readers.
+# Set up environment for all default profiles.
+for GUIX_PROFILE in "$HOME/.guix-home/profile" \
+                    "$HOME/.guix-profile" \
+                    "$HOME/.config/guix/current"
+do
+  if [ -f "$GUIX_PROFILE/etc/profile" ]; then
+    . "$GUIX_PROFILE/etc/profile"
+    if [ ! \"$GUIX_PROFILE\" = \"$HOME/.config/guix/current\" ]; then
+      # See info '(guix) Application Setup'.
+      case $GUIX_LOCPATH in
+        *GUIX_PROFILE/lib/locale*) ;;
+        *) export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH" ;;
+      esac
+    fi
+  fi
+  if [ \"$GUIX_PROFILE\" = \"$HOME/.config/guix/current\" ]; then
+    # Expose the latest Guix modules to Guile so guix shell and repls spawned by
+    # e.g. Geiser work out of the box.
+    case $GUILE_LOAD_PATH in
+      *$GUIX_PROFILE/share/guile/site/3.0*) ;;
+      *) export GUILE_LOAD_PATH=\"$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH\" ;;
+    esac
+    case $GUILE_LOAD_COMPILED_PATH in
+      *$GUIX_PROFILE/lib/guile/3.0/site-ccache*) ;;
+      *) export GUILE_LOAD_COMPILED_PATH=\"$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH\" ;;
+    esac
+  fi
+  # Make basic things just work when the user installs their first package.
+  case $PATH in
+    *$GUIX_PROFILE/bin*) ;;
+    *) export PATH="$GUIX_PROFILE/bin${PATH:+:}$PATH" ;;
+  esac
+  # Add to INFOPATH and MANPATH so the latest Guix documentation is available to
+  # info and man readers.  When INFOPATH is unset, add a trailing colon so Emacs
+  # searches 'Info-default-directory-list'.  When MANPATH is unset, add a
+  # trailing colon so the system default search path is used.
   case $INFOPATH in
     *$GUIX_PROFILE/share/info*) ;;
     *) export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH" ;;
   esac
   case $MANPATH in
     *$GUIX_PROFILE/share/man*) ;;
-    *) export MANPATH="$GUIX_PROFILE/share/man:$MANPATH"
+    *) export MANPATH="$GUIX_PROFILE/share/man:$MANPATH" ;;
   esac
-fi
+done
 
 # NOTE: Guix Home handles its own profile initialization in ~/.profile. See
 # info '(guix) Configuring the Shell'.
-
-# Clean up after ourselves.
-unset GUIX_PROFILE
 EOF
 }
 
-- 
2.49.0





Merged 77035 77522 77523 77524 77525 77526 77527 77528. Request was from Hilton Chain <hako <at> ultrarare.space> to control <at> debbugs.gnu.org. (Fri, 04 Apr 2025 03:28:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#77527; Package guix-patches. (Sat, 19 Apr 2025 02:41:04 GMT) Full text and rfc822 format available.

Message #10 received at 77527 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 77527 <at> debbugs.gnu.org
Subject: Re: [bug#77527] [PATCH v4 5/6] guix-install.sh: Group profile
 sourcing.
Date: Sat, 19 Apr 2025 10:45:22 +0800
Hilton Chain <hako <at> ultrarare.space> writes:

> [...]
> +  if [ \"$GUIX_PROFILE\" = \"$HOME/.config/guix/current\" ]; then
> +    # Expose the latest Guix modules to Guile so guix shell and repls spawned by
> +    # e.g. Geiser work out of the box.
> +    case $GUILE_LOAD_PATH in
> +      *$GUIX_PROFILE/share/guile/site/3.0*) ;;
> +      *) export GUILE_LOAD_PATH=\"$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH\" ;;
> +    esac
> +    case $GUILE_LOAD_COMPILED_PATH in
> +      *$GUIX_PROFILE/lib/guile/3.0/site-ccache*) ;;
> +      *) export
> GUILE_LOAD_COMPILED_PATH=\"$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH\"
> ;;
Maybe not needed, since 'guix repl' handle this.

> [...]
> -# Clean up after ourselves.
> -unset GUIX_PROFILE

I think it's still needed, since after the for loop the variable is
still visible.

Otherwise look good to me, thanks!




Information forwarded to guix-patches <at> gnu.org:
bug#77527; Package guix-patches. (Sat, 19 Apr 2025 20:36:01 GMT) Full text and rfc822 format available.

Message #13 received at 77527 <at> debbugs.gnu.org (full text, mbox):

From: Liam Hupfer <liam <at> hpfr.net>
To: Hilton Chain <hako <at> ultrarare.space>, 77527 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: Re: [bug#77527] [PATCH v4 5/6] guix-install.sh: Group profile
 sourcing.
Date: Sat, 19 Apr 2025 15:34:47 -0500
[Message part 1 (text/plain, inline)]
Hi Hilton!

I recently removed Guix Home profile initialization from the
system-level shell profile in bug#76082
(<https://issues.guix.gnu.org/76082>), hence the explicit comment. The
rationale is provided in the cover letter, [[bug#76082] [PATCH 0/9]
Improve profile initialization on foreign distros plus misc
improvements], and commit [[bug#76082] [PATCH 4/9] guix-install.sh: Remove
system-level Guix Home initialization.].

I would advocate against attempting to initialize the Guix Home profile
in the system ‘/etc/profile/’ files (or in Guix System’s equivalent
system-level shell initialization). Guix Home is capable of initializing
itself entirely at the user level. This is the default behavior and
documented in the manual at ‘(guix) Configuring the Shell’. Guix Home
users retain more control over fine-tuning shell initialization this
way. It also keeps search path variables tidy by preventing duplicating
Guix Home initialization at the system and user level.

WDYT?

Thanks!

PS: maybe not so useful if/when the Codeberg migration happens, but
‘(guix) Multiple Patches’ documents handy workarounds for Debbugs’s rather
subpar handling of patch series.

—Liam


[[bug#76082] [PATCH 0/9]
Improve profile initialization on foreign distros plus misc
improvements] <https://yhetil.org/guix/cover.1738814583.git.liam <at> hpfr.net/>

[[bug#76082] [PATCH 4/9] guix-install.sh: Remove
system-level Guix Home initialization.] <https://yhetil.org/guix/e63a2a0b73f6d0147ccb4fe814dd9c6e6ecd14ff.1738815703.git.liam <at> hpfr.net/>

Information forwarded to guix-patches <at> gnu.org:
bug#77527; Package guix-patches. (Sun, 20 Apr 2025 00:17:02 GMT) Full text and rfc822 format available.

Message #16 received at 77527 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Liam Hupfer <liam <at> hpfr.net>
Cc: 77527 <at> debbugs.gnu.org
Subject: Re: [bug#77527] [PATCH v4 5/6] guix-install.sh: Group profile
 sourcing.
Date: Sun, 20 Apr 2025 08:15:53 +0800
On Sun, 20 Apr 2025 04:34:47 +0800,
Liam Hupfer wrote:
>
> [1  <text/plain; utf-8 (quoted-printable)>]
> Hi Hilton!
>
> I recently removed Guix Home profile initialization from the
> system-level shell profile in bug#76082
> (<https://issues.guix.gnu.org/76082>), hence the explicit comment. The
> rationale is provided in the cover letter, [[bug#76082] [PATCH 0/9]
> Improve profile initialization on foreign distros plus misc
> improvements], and commit [[bug#76082] [PATCH 4/9] guix-install.sh: Remove
> system-level Guix Home initialization.].
>
> I would advocate against attempting to initialize the Guix Home profile
> in the system ‘/etc/profile/’ files (or in Guix System’s equivalent
> system-level shell initialization). Guix Home is capable of initializing
> itself entirely at the user level. This is the default behavior and
> documented in the manual at ‘(guix) Configuring the Shell’. Guix Home
> users retain more control over fine-tuning shell initialization this
> way. It also keeps search path variables tidy by preventing duplicating
> Guix Home initialization at the system and user level.
>
> WDYT?

This patch series is for avoiding search path duplication, and search paths for
Guix Home won't be initialized again if it's already done (see [PATCH v4 3/6]).

If initializing Guix Home separately, search path ordering can't be ensured, and
on Guix System ~/.guix-home/profile/bin has higher precedence than
/run/privileged/bin.

> Thanks!
>
> PS: maybe not so useful if/when the Codeberg migration happens, but
> ‘(guix) Multiple Patches’ documents handy workarounds for Debbugs’s rather
> subpar handling of patch series.

I forget it sometimes if I'm dealing with other things :)

> ―Liam
>
>
> [[bug#76082] [PATCH 0/9]
> Improve profile initialization on foreign distros plus misc
> improvements] <https://yhetil.org/guix/cover.1738814583.git.liam <at> hpfr.net/>
>
> [[bug#76082] [PATCH 4/9] guix-install.sh: Remove
> system-level Guix Home initialization.] <https://yhetil.org/guix/e63a2a0b73f6d0147ccb4fe814dd9c6e6ecd14ff.1738815703.git.liam <at> hpfr.net/>




Information forwarded to guix-patches <at> gnu.org:
bug#77527; Package guix-patches. (Tue, 22 Apr 2025 23:30:02 GMT) Full text and rfc822 format available.

Message #19 received at 77527 <at> debbugs.gnu.org (full text, mbox):

From: Liam Hupfer <liam <at> hpfr.net>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 77527 <at> debbugs.gnu.org
Subject: Re: [bug#77527] [PATCH v4 5/6] guix-install.sh: Group profile
 sourcing.
Date: Tue, 22 Apr 2025 18:29:25 -0500
[Message part 1 (text/plain, inline)]
Hilton Chain <hako <at> ultrarare.space> writes:

> This patch series is for avoiding search path duplication, and search paths for
> Guix Home won’t be initialized again if it’s already done (see [PATCH v4 3/6]).
>
> If initializing Guix Home separately, search path ordering can’t be ensured, and
> on Guix System ~/.guix-home/profile/bin has higher precedence than
> /run/privileged/bin.

Hmm, IMO Guix Home should own the initialization of system paths if such
an ordering is desirable rather than vice versa, but I’m fine with this
approach too. Thanks!

—Liam

This bug report was last modified 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.