From patchwork Mon Mar 31 16:25:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 41086 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 0F4AD27BBE9; Mon, 31 Mar 2025 17:27:28 +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=-5.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_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 4666C27BBE2 for ; Mon, 31 Mar 2025 17:27:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzHyi-0004lo-Nt; Mon, 31 Mar 2025 12:27:12 -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 1tzHyh-0004gT-8x for guix-patches@gnu.org; Mon, 31 Mar 2025 12:27:11 -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 1tzHyf-0001FV-Od; Mon, 31 Mar 2025 12:27:10 -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=uaRJtr4Oimk15LlT3xQw2nloVJ56z2EOx+qIeINJmeA=; b=PAFB/vbPEEwrKcHajSI0u/s5y48ccW3MF3aYcRwssP7tWc6fcFfQRXvNa2RNlJxncu6H3klTyr6HeG0kqNwINIH5vW0/vV0MysPZdulYelNJb9b2HchKBRVsw4q+yHgEPJQARgsQozBomc4m6PtFBluSVBFnAs0Ys8PUvz0ToSBx0Da6sxa2SIf9dt5exTEC0CUd0cpY7FUh8IfTNXZt6zMihrJtelr9Z0xh3nywU1XTg5F5u/wnf3TlqRx4BRlses8Boh386JvWnHJy1dfd3oT44m0DdEreXsNm/c5eO2tUDTpUxRW2XsUZjDBOKq7onXoUXENRR1TEaDQHDag06A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tzHyZ-0005vE-HS; Mon, 31 Mar 2025 12:27:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77035] [PATCH v2 2/3] home: setup-environment: Skip if already initialized. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, ludo@gnu.org, andrew@trop.in, janneke@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Mon, 31 Mar 2025 16:27: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?= , Andrew Tropin , Janneke Nieuwenhuizen , Tanguy Le Carrour X-Debbugs-Original-Xcc: Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= , Andrew Tropin , Janneke Nieuwenhuizen , Tanguy Le Carrour Received: via spool by 77035-submit@debbugs.gnu.org id=B77035.174343841822721 (code B ref 77035); Mon, 31 Mar 2025 16:27:03 +0000 Received: (at 77035) by debbugs.gnu.org; 31 Mar 2025 16:26:58 +0000 Received: from localhost ([127.0.0.1]:42592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzHyU-0005uH-36 for submit@debbugs.gnu.org; Mon, 31 Mar 2025 12:26:58 -0400 Received: from mx.boiledscript.com ([2a01:4f8:10b:392::42]:55954) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzHyM-0005t9-Eo for 77035@debbugs.gnu.org; Mon, 31 Mar 2025 12:26:51 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1743438409; 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=uaRJtr4Oimk15LlT3xQw2nloVJ56z2EOx+qIeINJmeA=; b=N/J+jkq1NGrSwXzTVfXRuV/7vY8/rVnaV6tf3mpXG+mDik9MMeYoqc19syVjUFYMH3FisG ZCsjkCHMmVwnnvzCe5IxLFq+KaiFkPHxYVswf4CAx+4AzF+pwVXMEnG0JRDQ0ZH2755ky7 1xJOi3ytut7w0gVD1ahOzLqx2D4uPeunqv81opM6O7Rclg/tohqTfUVi2EyHJ2v0hpVwVr 7FbNO4s1wX+XWkNWXqtE+Vs2ohThH/F1/jS0SXAHXcaNPqE2eimvsI9+S042WF6Jx2OSp0 /5VJliCsVUP8gUSqFecrk+vvRwZOx7txusVLQsuzcaY0e3rK2WS1yQw+E+lw4A== Date: Tue, 1 Apr 2025 00:25:57 +0800 Message-ID: <70536e22ec65aeb8f27f140417c43b075e774a92.1743438266.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-MS-Reactions: disallow 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/home/services.scm (environment-variables->setup-environment-script): Skip initializing home profile if already finished. Address some issues reported by ‘shellcheck’. * gnu/home/services/shells.scm (add-shell-profile-file): Skip setup-environment if already finished. Address some issues reported by ‘shellcheck’. Change-Id: Ife4100c6b19f61272525eebc82931c81784fe9e0 --- gnu/home/services.scm | 18 +++++++++++------- gnu/home/services/shells.scm | 10 +++++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 85a43f80ca..39ad31515c 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -279,31 +279,35 @@ (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*) ;; - *) export GUIX_LOCPATH=$GUIX_PROFILE/lib/locale:$GUIX_LOCPATH ;; + *) export GUIX_LOCPATH=\"$GUIX_PROFILE/lib/locale:$GUIX_LOCPATH\" ;; esac case $XDG_DATA_DIRS in *$GUIX_PROFILE/share*) ;; - *) export XDG_DATA_DIRS=$GUIX_PROFILE/share:$XDG_DATA_DIRS ;; + *) export XDG_DATA_DIRS=\"$GUIX_PROFILE/share:$XDG_DATA_DIRS\" ;; esac case $MANPATH in *$GUIX_PROFILE/share/man*) ;; - *) export MANPATH=$GUIX_PROFILE/share/man:$MANPATH + *) export MANPATH=\"$GUIX_PROFILE/share/man:$MANPATH\" ;; esac case $INFOPATH in *$GUIX_PROFILE/share/info*) ;; - *) export INFOPATH=$GUIX_PROFILE/share/info:$INFOPATH ;; + *) export INFOPATH=\"$GUIX_PROFILE/share/info:$INFOPATH\" ;; esac case $XDG_CONFIG_DIRS in *$GUIX_PROFILE/etc/xdg*) ;; - *) export XDG_CONFIG_DIRS=$GUIX_PROFILE/etc/xdg:$XDG_CONFIG_DIRS ;; + *) export XDG_CONFIG_DIRS=\"$GUIX_PROFILE/etc/xdg:$XDG_CONFIG_DIRS\" ;; esac case $XCURSOR_PATH in *$GUIX_PROFILE/share/icons*) ;; - *) export XCURSOR_PATH=$GUIX_PROFILE/share/icons:$XCURSOR_PATH ;; + *) export XCURSOR_PATH=\"$GUIX_PROFILE/share/icons:$XCURSOR_PATH\" ;; esac # Keep the shell environment clean. diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index bab5730c3d..ce61eaa4b0 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -87,9 +87,13 @@ (define (add-shell-profile-file config) ,(mixed-text-file "shell-profile" "\ -HOME_ENVIRONMENT=$HOME/.guix-home -. $HOME_ENVIRONMENT/setup-environment -$HOME_ENVIRONMENT/on-first-login +HOME_ENVIRONMENT=\"$HOME/.guix-home\" +# Skip if already sourced. +case $GUIX_LOCPATH in + *$HOME_ENVIRONMENT/profile/lib/locale*) ;; + *) . \"$HOME_ENVIRONMENT/setup-environment\" ;; +esac +\"$HOME_ENVIRONMENT/on-first-login\" unset HOME_ENVIRONMENT\n" (serialize-configuration config