Subject: bug#20255: [PATCH 3/4] system: Only source system profile's settings in '/etc/profile'.

From: [email-masked]
Date: Wed, 17 May 2023 22:04:10 +0800

From: 宋文武 <[email-masked]>

This is a followup to 40310efde9b4a4f2cf98081d6cd10f843685ebb6.

* gnu/system.scm (operating-system-etc-service)[profile]:
Don't source profile of '~/.guix-profile' and '~/.config/guix/current'.
---
 gnu/system.scm | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 354f58f55b..a48c206e18 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1009,8 +1009,8 @@ (define* (operating-system-etc-service os)
         ;; environment variables.
         (profile    (mixed-text-file "profile"  "\
 # Crucial variables that could be missing in the profiles' 'etc/profile'
-# because they would require combining both profiles.
-# FIXME: See <http://bugs.gnu.org/20255>.
+# because they would require honoring search paths of dependencies.
+# FIXME: See <http://bugs.gnu.org/22138>.
 export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
 export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
@@ -1037,27 +1037,12 @@ (define* (operating-system-etc-service os)
   export `cat /etc/environment | cut -d= -f1`
 fi
 
-# 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
+# Make basic things just work when the user installs their first package.
+export PATH=\"$HOME/.config/guix/current/bin:$HOME/.guix-profile/bin:$PATH\"
 
 # Prepend setuid programs.
 export PATH=/run/setuid-programs:$PATH
 
-# Arrange so that ~/.config/guix/current/share/info comes first.
-export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\"
-
 # Set the umask, notably for users logging in via 'lsh'.
 # See <http://bugs.gnu.org/22650>.
 umask 022
-- 
2.40.1