summaryrefslogtreecommitdiff
path: root/etc/guix-install.sh
diff options
context:
space:
mode:
authorLiam Hupfer <liam@hpfr.net>2025-02-05 22:25:01 -0600
committerLudovic Courtès <ludo@gnu.org>2025-02-21 15:27:11 +0100
commitf9789e9bc6aff0ddd7b72805ec4d81a740acfe44 (patch)
treeb3e87ef27e3893d9be6d445b71cefdcb30be6c2c /etc/guix-install.sh
parentf726d616f80d33cce0a05c2e90a4db7bb7026d84 (diff)
guix-install.sh: Improve Guix profile sourcing.
Make both profiles use GUIX_PROFILE and reorder some code so each profile is handled in one contiguous block. The user’s profile now takes precedence over the ‘guix pull’ profile on INFOPATH. If the user already has an info reader in their Guix profile, don’t add a duplicate entry to INFOPATH. If the user doesn’t have an imperative ~/.guix-profile (i.e. they manage software with Guix Home and ‘guix shell’), don’t add an unnecessary entry to INFOPATH. Clean up after ourselves by unsetting the temporary GUIX_PROFILE variable, which only needs to be set when sourcing. * etc/guix-install.sh (sys_create_init_profile): Improve Guix profile sourcing. Change-Id: Ibceb354012d23d24deeb39b1ec02790873396a6b Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'etc/guix-install.sh')
-rwxr-xr-xetc/guix-install.sh50
1 files changed, 30 insertions, 20 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 8dda149edfa..9a1d898b4ba 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -649,31 +649,41 @@ export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}"
649export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" 649export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
650# no default for XDG_RUNTIME_DIR (depends on foreign distro for semantics) 650# no default for XDG_RUNTIME_DIR (depends on foreign distro for semantics)
651 651
652# _GUIX_PROFILE: `guix pull` profile 652# `guix pull` profile
653_GUIX_PROFILE="$HOME/.config/guix/current" 653GUIX_PROFILE="$HOME/.config/guix/current"
654export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH" 654export PATH="$GUIX_PROFILE/bin${PATH:+:}$PATH"
655 655# Add to INFOPATH so the latest Guix documentation is available to info
656# GUIX_PROFILE: User's default profile and home profile 656# readers. When INFOPATH is unset, add a trailing colon so that Emacs searches
657# 'Info-default-directory-list'.
658export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH"
659# Expose the latest Guix modules to Guile so guix shell and repls spawned by
660# e.g. Geiser work out of the box.
661export GUILE_LOAD_PATH="$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
662export GUILE_LOAD_COMPILED_PATH="$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
663
664# User's default profile, if it exists
657GUIX_PROFILE="$HOME/.guix-profile" 665GUIX_PROFILE="$HOME/.guix-profile"
658[ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile" 666if [ -L "$GUIX_PROFILE" ]; then
659[ -L "$GUIX_PROFILE" ] && \ 667 . "$GUIX_PROFILE/etc/profile"
660GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH" 668
661 669 # see info '(guix) Application Setup'
662# Export INFOPATH so that the updated info pages can be found 670 export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH"
663# and read by both /usr/bin/info and/or $GUIX_PROFILE/bin/info 671
664# When INFOPATH is unset, add a trailing colon so that Emacs 672 # INFOPATH may be handled by $GUIX_PROFILE/etc/profile if the user installs
665# searches 'Info-default-directory-list'. 673 # an info reader via Guix. If the user doesn’t, explicitly add to INFOPATH
666export INFOPATH="$_GUIX_PROFILE/share/info:$GUIX_PROFILE/share/info:$INFOPATH" 674 # so documentation for software from ‘guix install’ is available to the
675 # system info reader.
676 case $INFOPATH in
677 *$GUIX_PROFILE/share/info*) ;;
678 *) export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH" ;;
679 esac
680fi
667 681
668# NOTE: Guix Home handles its own profile initialization in ~/.profile. See 682# NOTE: Guix Home handles its own profile initialization in ~/.profile. See
669# info '(guix) Configuring the Shell'. 683# info '(guix) Configuring the Shell'.
670 684
671export GUIX_LOCPATH 685# Clean up after ourselves.
672 686unset GUIX_PROFILE
673# Make Guix modules available
674export GUILE_LOAD_PATH="$_GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
675export GUILE_LOAD_COMPILED_PATH="$_GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
676
677EOF 687EOF
678} 688}
679 689