Subject: Re: [bug#77525] [PATCH v4 2/6] system: /etc/profile: Rearrange to avoid search path duplication.

From: 宋文武 <[email-masked]>
Date: Sat, 19 Apr 2025 10:13:52 +0800

Hilton Chain <[email-masked]> writes:

> * gnu/system.scm (operating-system-etc-service)[profile]: Set umask first.
OK.

> Group environment variables setup with profile sourcing to avoid duplication.
It was already grouped in previous commit, maybe "Setup crucial
variables from all the default profiles."

> Export $GUILE_LOAD_PATH and $GUILE_LOAD_COMPILED_PATH for ‘guix pull’ profile.
Could be a seperated commit, but maybe not needed?  Since 'guix repl'
would ensure it.

> * gnu/system/shadow.scm (%default-bash-profile): Remove duplicated exports.
I think this better go into a seperated commit, and with comment or
cookbook doc for the merge search paths from multiple profiles usage.

> [...]
>  do
> -  if [ -f \"$GUIX_PROFILE/etc/profile\" ]
> -  then
> +  if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
>      . \"$GUIX_PROFILE/etc/profile\"
> -  else
> -    # At least define this one so that basic things just work
> -    # when the user installs their first package.
> -    export PATH=\"$GUIX_PROFILE/bin:$PATH\"
> +    if [ ! \"$GUIX_PROFILE\" = \"$HOME/.config/guix/current\" ]; then
> +      # 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>.
> +      case $XDG_DATA_DIRS in
> +        *$GUIX_PROFILE/share*) ;;
> +        *) export XDG_DATA_DIRS=\"$GUIX_PROFILE/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS\" ;;
> +      esac
> +      case $XDG_CONFIG_DIRS in
> +        *$GUIX_PROFILE/etc/xdg*) ;;
> +        *) export XDG_CONFIG_DIRS=\"$GUIX_PROFILE/etc/xdg${XDG_CONFIG_DIRS:+:}$XDG_CONFIG_DIRS\" ;;
> +      esac
> +      # Make sure libXcursor finds cursors installed into user or system profiles.
> +      # See <http://bugs.gnu.org/24445>

Commit 2acfafff set XCURSORPATH contains user and system profiles, but
not home profile as this patch did, this comment about 24445 can be
removed.

Otherwise, look good to me!