diff options
| author | Liam Hupfer <liam@hpfr.net> | 2025-02-05 22:25:01 -0600 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-02-21 15:27:11 +0100 |
| commit | f9789e9bc6aff0ddd7b72805ec4d81a740acfe44 (patch) | |
| tree | b3e87ef27e3893d9be6d445b71cefdcb30be6c2c /etc/guix-install.sh | |
| parent | f726d616f80d33cce0a05c2e90a4db7bb7026d84 (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-x | etc/guix-install.sh | 50 |
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}" | |||
| 649 | export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" | 649 | export 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" | 653 | GUIX_PROFILE="$HOME/.config/guix/current" |
| 654 | export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH" | 654 | export 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'. | ||
| 658 | export 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. | ||
| 661 | export GUILE_LOAD_PATH="$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" | ||
| 662 | export 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 | ||
| 657 | GUIX_PROFILE="$HOME/.guix-profile" | 665 | GUIX_PROFILE="$HOME/.guix-profile" |
| 658 | [ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile" | 666 | if [ -L "$GUIX_PROFILE" ]; then |
| 659 | [ -L "$GUIX_PROFILE" ] && \ | 667 | . "$GUIX_PROFILE/etc/profile" |
| 660 | GUIX_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 |
| 666 | export 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 | ||
| 680 | fi | ||
| 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 | ||
| 671 | export GUIX_LOCPATH | 685 | # Clean up after ourselves. |
| 672 | 686 | unset GUIX_PROFILE | |
| 673 | # Make Guix modules available | ||
| 674 | export GUILE_LOAD_PATH="$_GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" | ||
| 675 | export GUILE_LOAD_COMPILED_PATH="$_GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" | ||
| 676 | |||
| 677 | EOF | 687 | EOF |
| 678 | } | 688 | } |
| 679 | 689 | ||
