From patchwork Thu Feb 6 04:25:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liam Hupfer X-Patchwork-Id: 38302 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 051D027BBE9; Thu, 6 Feb 2025 04:27:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 81F0A27BBE2 for ; Thu, 6 Feb 2025 04:27:17 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tftTp-0000Pu-Mw; Wed, 05 Feb 2025 23:27:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tftTn-0000P9-1K for guix-patches@gnu.org; Wed, 05 Feb 2025 23:27:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tftTk-00017Y-5U; Wed, 05 Feb 2025 23:27:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=VRwAYy6Q5fx0DBU7LA8wbxgxc9fhIesnYV/BG+h0dgw=; b=HT2/CJe+TFzqcpEPTivbhrkwFcZSceHbEYEQ5RO8EpGMJgg2TyJwrOOhP2e5JUBf38motGVtMAsHQqV7YJdCgVdMdgRpjrM8oTjL4RQ20WQxc3MEgWF3hxst3pJsSNDqNsARqEWfW7e42brCDU5dxu5ZSHQuIbDhPjBPpqqfB+oBpC4LBIj6qsLxb4kfCeZP89J2qQ2HMRgagtKxg2bMZ2kUfDJ86unbbXWq5WZ8ecn01OQhzE+k2/fPU/On2L24mu4iAnAOhAhD3lECl8qSMoKxwKa3lshE3QBEfblVnWMeZVGaHoAkS19TPDBjLw+nPYxfUGv6AiikSo3GP3X22g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tftTj-0002XP-42; Wed, 05 Feb 2025 23:27:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76082] [PATCH 5/9] guix-install.sh: Improve Guix profile sourcing. Resent-From: Liam Hupfer Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Feb 2025 04:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76082 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76082@debbugs.gnu.org Cc: Liam Hupfer , Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour , Vagrant Cascadian X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour , Vagrant Cascadian Received: via spool by 76082-submit@debbugs.gnu.org id=B76082.17388159829604 (code B ref 76082); Thu, 06 Feb 2025 04:27:03 +0000 Received: (at 76082) by debbugs.gnu.org; 6 Feb 2025 04:26:22 +0000 Received: from localhost ([127.0.0.1]:53620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tftT3-0002Uq-N0 for submit@debbugs.gnu.org; Wed, 05 Feb 2025 23:26:22 -0500 Received: from out-178.mta1.migadu.com ([2001:41d0:203:375::b2]:22176) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tftT1-0002UM-1P for 76082@debbugs.gnu.org; Wed, 05 Feb 2025 23:26:19 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpfr.net; s=key1; t=1738815972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VRwAYy6Q5fx0DBU7LA8wbxgxc9fhIesnYV/BG+h0dgw=; b=lbP8oxQGFcmA87wStqyeYNr9uGpNbitJzda8UEnkRKl19aVfGz/9drkTkFHX6ECQC3QaF/ T+5cdjGwcMxTExAo7OH/EK540UKSBSvtCuaRB8P+VXcllu9xLjT2475EoEhkMyKykxcJnS EKnWjRIAMoa/EUr/gDcKJO5jIpMvv02VFol00EL/qQrYpRwvVJu0C3kXN7IwdErPd3S/OY pG3IfKb+XXm3+ig70V4a9A3su95MIriLQqNqg9PS7Jhf/fbBD30fZUzDZv3F6lIgV3K+N9 gDt2F7+G6HzykvIx5/YtIYgw2W45tpxxYIhAEiYm/N717ymB9MKGt7+Ht1v+Bg== From: Liam Hupfer Date: Wed, 5 Feb 2025 22:25:01 -0600 Message-ID: <1c3233c704528b298ba3fb884bc8ab29b8b84001.1738815703.git.liam@hpfr.net> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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 --- etc/guix-install.sh | 50 +++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 8dda149edf..9a1d898b4b 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -649,31 +649,41 @@ export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}" export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" # no default for XDG_RUNTIME_DIR (depends on foreign distro for semantics) -# _GUIX_PROFILE: `guix pull` profile -_GUIX_PROFILE="$HOME/.config/guix/current" -export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH" - -# GUIX_PROFILE: User's default profile and home profile +# `guix pull` profile +GUIX_PROFILE="$HOME/.config/guix/current" +export PATH="$GUIX_PROFILE/bin${PATH:+:}$PATH" +# Add to INFOPATH so the latest Guix documentation is available to info +# readers. When INFOPATH is unset, add a trailing colon so that Emacs searches +# 'Info-default-directory-list'. +export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH" +# Expose the latest Guix modules to Guile so guix shell and repls spawned by +# e.g. Geiser work out of the box. +export GUILE_LOAD_PATH="$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" +export GUILE_LOAD_COMPILED_PATH="$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" + +# User's default profile, if it exists GUIX_PROFILE="$HOME/.guix-profile" -[ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile" -[ -L "$GUIX_PROFILE" ] && \ -GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH" - -# Export INFOPATH so that the updated info pages can be found -# and read by both /usr/bin/info and/or $GUIX_PROFILE/bin/info -# When INFOPATH is unset, add a trailing colon so that Emacs -# searches 'Info-default-directory-list'. -export INFOPATH="$_GUIX_PROFILE/share/info:$GUIX_PROFILE/share/info:$INFOPATH" +if [ -L "$GUIX_PROFILE" ]; then + . "$GUIX_PROFILE/etc/profile" + + # see info '(guix) Application Setup' + export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH" + + # INFOPATH may be handled by $GUIX_PROFILE/etc/profile if the user installs + # an info reader via Guix. If the user doesn’t, explicitly add to INFOPATH + # so documentation for software from ‘guix install’ is available to the + # system info reader. + case $INFOPATH in + *$GUIX_PROFILE/share/info*) ;; + *) export INFOPATH="$GUIX_PROFILE/share/info:$INFOPATH" ;; + esac +fi # NOTE: Guix Home handles its own profile initialization in ~/.profile. See # info '(guix) Configuring the Shell'. -export GUIX_LOCPATH - -# Make Guix modules available -export GUILE_LOAD_PATH="$_GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" -export GUILE_LOAD_COMPILED_PATH="$_GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" - +# Clean up after ourselves. +unset GUIX_PROFILE EOF }