From patchwork Tue Apr 1 15:02:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 41129 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 9A8CE27BBEA; Tue, 1 Apr 2025 16:04:48 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,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=ham 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 D55A027BBE2 for ; Tue, 1 Apr 2025 16:04:45 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzd9q-00085a-Eo; Tue, 01 Apr 2025 11:04:06 -0400 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 1tzd9o-00084o-EI for guix-patches@gnu.org; Tue, 01 Apr 2025 11:04:04 -0400 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 1tzd9o-00034F-3N; Tue, 01 Apr 2025 11:04:04 -0400 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=6XZY0UxXtrqDwpAwWtGpj7IGxWacYvVcVdj1piY/gr8=; b=t/FFjcd5eVmjiZlb54htJkpghaEVBccLtgCLUracjcNDLP9rISy4dZ/VnSaAhMsoRNjJjthBIlScnjgBqQ5vpupyvQQp+u+vmS/d01FXZx+cptHNQ0U8+Yp1jQLH6/Vo1DAJez7VNxFwL0x1saDWIu3OrJR4TsqDZDJDgArtsCg/vhMknfrLL2sKKkr2/HpCraSA3g+Bbnnxz6vdUyG4kIj26Q/1sg4U6duzilzBxVZeIkWYyhK0eEyKz9tOuIUiTOpryD8XCppOHjnfG3KmeJBD53Y6DQOTohp1vkmct6G2JkKKJB6+803lhiJPqInhSK1lSVdRDkoTPVPxgRHiUA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tzd9n-0004C3-Ra; Tue, 01 Apr 2025 11:04:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77035] [PATCH v3 2/5] system: Rearrange /etc/profile. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 01 Apr 2025 15:04:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77035 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77035@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77035-submit@debbugs.gnu.org id=B77035.174351983616047 (code B ref 77035); Tue, 01 Apr 2025 15:04:03 +0000 Received: (at 77035) by debbugs.gnu.org; 1 Apr 2025 15:03:56 +0000 Received: from localhost ([127.0.0.1]:50018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzd9f-0004Aj-UH for submit@debbugs.gnu.org; Tue, 01 Apr 2025 11:03:56 -0400 Received: from mx.boiledscript.com ([88.99.243.112]:58954) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzd9b-0004A5-Sm for 77035@debbugs.gnu.org; Tue, 01 Apr 2025 11:03:52 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1743519830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XZY0UxXtrqDwpAwWtGpj7IGxWacYvVcVdj1piY/gr8=; b=UxyH3vOzSV7LTKZh/KSdG8Yp7quwtVk5a525VN19oVMuSZHsOKLH/cH1/p2WHcMYhKtt0l ih7nvSAzXD8+r9iok2MkwPWjds7LL2WHna8rcC3e/GUVfo1kg6Hq7KGp3bCYMw26wVTnpr pEg61E4BC4HKFQdN1OWHWlIZVMe3KziB8jcYqVhlhDESbVPK8k1iA+19mZpQN9rUYXGzXx RhppTy7aSLsFezBpcqkIS8bvFtVCx6Gxn21onZ6pX9ueM5yLZEBwlZOiFUcymkkedB9WLJ UoyTT5XRYb01bD4wrF2Su+r7hN3xB9Ckk4EVyzlKhKgdEQ7fHqNMvD7Jr3ueUg== Date: Tue, 1 Apr 2025 23:02:45 +0800 Message-ID: <61d3d34032d3dfcc71fff9f9e52093a65339065f.1743519525.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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 * gnu/system.scm (operating-system-etc-service)[profile]: Set umask first. Move extra environment variables setup into the iteration. Add $GUILE_LOAD_PATH and $GUILE_LOAD_COMPILED_PATH. * gnu/system/shadow.scm (%default-bash-profile): Remove duplicated exports. Change-Id: I42ae153b9cd47ca24448fa18ce7f80a5e5c06621 --- gnu/system.scm | 90 +++++++++++++++++++++++++++++-------------- gnu/system/shadow.scm | 10 ----- 2 files changed, 61 insertions(+), 39 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index c166222854..9fb4275b45 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1060,16 +1060,9 @@ (define* (operating-system-etc-service os) ;; Startup file for POSIX-compliant login shells, which set system-wide ;; environment variables. (profile (mixed-text-file "profile" "\ -# Crucial variables that could be missing in the profiles' 'etc/profile' -# because they would require combining both profiles. -# FIXME: See . -export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man -export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info -export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share -export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg - -# Make sure libXcursor finds cursors installed into user or system profiles. See -export XCURSOR_PATH=$HOME/.icons:$HOME/.guix-profile/share/icons:/run/current-system/profile/share/icons +# Set the umask, notably for users logging in via 'lsh'. +# See . +umask 022 # Ignore the default value of 'PATH'. unset PATH @@ -1094,29 +1087,68 @@ (define* (operating-system-etc-service os) 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\" fi + # At least define this one so that basic things just work when the user + # installs their first package. + case $PATH in + *$GUIX_PROFILE/bin*) ;; + *) export PATH=\"$GUIX_PROFILE/bin${PATH:+:}$PATH\" ;; + esac + # Crucial variables that could be missing in the profiles' 'etc/profile' + # because they would require combining both profiles. + # FIXME: See . + 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 + # When INFOPATH is unset, add a trailing colon so Emacs searches + # 'Info-default-directory-list'. + case $INFOPATH in + *$GUIX_PROFILE/share/info*) ;; + *) export INFOPATH=\"$GUIX_PROFILE/share/info:$INFOPATH\" ;; + esac + # When MANPATH is unset, add a trailing colon so the system default search + # path is used. + case $MANPATH in + *$GUIX_PROFILE/share/man*) ;; + *) export MANPATH=\"$GUIX_PROFILE/share/man:$MANPATH\" ;; + esac + # Expose Guix modules to Guile so guix shell and repls spawned by e.g. Geiser + # work out of the box. + case $GUILE_LOAD_PATH in + *$GUIX_PROFILE/share/guile/site/3.0*) ;; + *) export GUILE_LOAD_PATH=\"$GUIX_PROFILE/share/guile/site/3.0${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH\" ;; + esac + case $GUILE_LOAD_COMPILED_PATH in + *$GUIX_PROFILE/lib/guile/3.0/site-ccache*) ;; + *) export GUILE_LOAD_COMPILED_PATH=\"$GUIX_PROFILE/lib/guile/3.0/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH\" ;; + esac + # Make sure libXcursor finds cursors installed into user or system profiles. + # See + case $XCURSOR_PATH in + *$GUIX_PROFILE/share/icons*) ;; + *) export XCURSOR_PATH=\"$GUIX_PROFILE/share/icons${XCURSOR_PATH:+:}$XCURSOR_PATH\" ;; + esac + # Allow Hunspell-based applications (IceCat, LibreOffice, etc.) to find + # dictionaries. + case $DICPATH in + *$GUIX_PROFILE/share/hunspell*) ;; + *) export DICPATH=\"$GUIX_PROFILE/share/hunspell${DICPATH:+:}$DICPATH\" ;; + esac + # Allow GStreamer-based applications to find plugins. + case $GST_PLUGIN_PATH in + *$GUIX_PROFILE/lib/gstreamer-1.0*) ;; + *) export GST_PLUGIN_PATH=\"$GUIX_PROFILE/lib/gstreamer-1.0${GST_PLUGIN_PATH:+:}$GST_PLUGIN_PATH\" ;; + esac done -# Prepend privileged programs. +# Prepend paths not in a profile. export PATH=/run/privileged/bin:$PATH - -# Arrange so that ~/.config/guix/current/share/info comes first. -export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\" - -# Set the umask, notably for users logging in via 'lsh'. -# See . -umask 022 - -# Allow Hunspell-based applications (IceCat, LibreOffice, etc.) to -# find dictionaries. -export DICPATH=\"$HOME/.guix-profile/share/hunspell:/run/current-system/profile/share/hunspell\" - -# Allow GStreamer-based applications to find plugins. -export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\" +export XCURSOR_PATH=\"$HOME/.icons:$XCURSOR_PATH\" if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ] then diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index b68a818871..cdb804da18 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -179,16 +179,6 @@ (define %default-bash-profile # Honor per-interactive-shell startup file if [ -f ~/.bashrc ]; then . ~/.bashrc; fi - -# Merge search-paths from multiple profiles, the order matters. -eval \"$(guix package --search-paths \\ --p $HOME/.config/guix/current \\ --p $HOME/.guix-home/profile \\ --p $HOME/.guix-profile \\ --p /run/current-system/profile)\" - -# Prepend setuid programs. -export PATH=/run/setuid-programs:$PATH ")) (define %default-zprofile