[bug#77526,v4,3/6] system: /etc/profile: Set up extra environment variables for Guix Home.
Commit Message
* gnu/system.scm (operating-system-etc-service)[profile]: Set up extra
environment variables for Guix Home.
* gnu/home/services/shells.scm (add-shell-profile-file): Skip
setup-environment if already finished.
* gnu/home/services.scm (environment-variables->setup-environment-script):
Skip initializing home profile if already finished.
Change-Id: Ife4100c6b19f61272525eebc82931c81784fe9e0
---
gnu/home/services.scm | 6 +++++-
gnu/home/services/shells.scm | 6 +++++-
gnu/system.scm | 5 +++++
3 files changed, 15 insertions(+), 2 deletions(-)
@@ -279,7 +279,11 @@ (define (environment-variables->setup-environment-script vars)
# ~/.profile does)
GUIX_PROFILE=\"$HOME_ENVIRONMENT/profile\"
PROFILE_FILE=\"$GUIX_PROFILE/etc/profile\"
-[ -f $PROFILE_FILE ] && . $PROFILE_FILE
+# Skip if already initialized.
+case $INFOPATH in
+ *$GUIX_PROFILE/share/info*) ;;
+ *) [ -f \"$PROFILE_FILE\" ] && . \"$PROFILE_FILE\" ;;
+esac
case $GUIX_LOCPATH in
*$GUIX_PROFILE/lib/locale*) ;;
@@ -88,7 +88,11 @@ (define (add-shell-profile-file config)
"shell-profile"
"\
HOME_ENVIRONMENT=$HOME/.guix-home
-. $HOME_ENVIRONMENT/setup-environment
+# Skip if already sourced.
+case $INFOPATH in
+ *$HOME_ENVIRONMENT/profile/share/info*) ;;
+ *) . \"$HOME_ENVIRONMENT/setup-environment\" ;;
+esac
$HOME_ENVIRONMENT/on-first-login
unset HOME_ENVIRONMENT\n"
(serialize-configuration
@@ -1148,6 +1148,11 @@ (define* (operating-system-etc-service os)
esac
done
+# Set up extra environment variables for Guix Home.
+HOME_ENVIRONMENT=\"$HOME/.guix-home\"
+[ -f \"$HOME_ENVIRONMENT/setup-environment\" ] && . \"$HOME_ENVIRONMENT/setup-environment\"
+unset HOME_ENVIRONMENT
+
# Prepend search paths not in a profile.
export PATH=/run/privileged/bin:$PATH
export XCURSOR_PATH=\"$HOME/.icons:$XCURSOR_PATH\"