From patchwork Fri Apr 4 03:23:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 41260 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 B41DD27BBEA; Fri, 4 Apr 2025 04:24:59 +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 ACC1327BBE2 for ; Fri, 4 Apr 2025 04:24:58 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u0XfF-0006y5-Mf; Thu, 03 Apr 2025 23:24:17 -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 1u0Xf9-0006w3-Il for guix-patches@gnu.org; Thu, 03 Apr 2025 23:24: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 1u0Xf8-0002mn-Iv; Thu, 03 Apr 2025 23:24:11 -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=tm9Lvhwm7Z/F7x6u5dWGMXUbr4UiI1vKjwS8fQdmtt0=; b=qYtJRvSBpnmSlcqbBdPiKv7W10Iwbj/KLxwmUYWMmsQnCq+GC9Ac6d8EE+hGfuafI8VwsZ3RfTrbJZANykwrO7GtPWFDuAoXAVFOHzrIUStdhwKXeKL1IUB60RXyoc5/x+WKOjHthbDz/yosrFeTYVTargc8LeH5u+4N9s+zdf0h1Unqvoxuj+zk+XTdUOJJY4lXPCeklCHhcLhP3yScXf09Q9rOSFHHckZKTp4pYEkn+kQ3SGA2gjTHzOY/k+AptqD8Wx6T25LqAmO+4sd5rYgBmLWbalMKZkqBhUv5kiIkPQQ4qqmzx2jg2mAp31BQDiMtSPvFZWLIp7joeI7/8g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u0Xf5-0002d5-7l; Thu, 03 Apr 2025 23:24:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77526] [PATCH v4 3/6] system: /etc/profile: Set up extra environment variables for Guix Home. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, hako@ultrarare.space, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Fri, 04 Apr 2025 03:24:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77526 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77526@debbugs.gnu.org Cc: Hilton Chain , Andrew Tropin , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Andrew Tropin , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by submit@debbugs.gnu.org id=B.174373703710010 (code B ref -1); Fri, 04 Apr 2025 03:24:06 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2025 03:23:57 +0000 Received: from localhost ([127.0.0.1]:36546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0Xeu-0002bN-RZ for submit@debbugs.gnu.org; Thu, 03 Apr 2025 23:23:57 -0400 Received: from lists.gnu.org ([2001:470:142::17]:32922) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0Xeo-0002a2-CI for submit@debbugs.gnu.org; Thu, 03 Apr 2025 23:23:53 -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 1u0Xei-0006su-QO for guix-patches@gnu.org; Thu, 03 Apr 2025 23:23:44 -0400 Received: from mx.boiledscript.com ([2a01:4f8:10b:392::42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0Xeh-0002hu-7x for guix-patches@gnu.org; Thu, 03 Apr 2025 23:23:44 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1743737021; 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=tm9Lvhwm7Z/F7x6u5dWGMXUbr4UiI1vKjwS8fQdmtt0=; b=Mtr+xzaDPlPyNGlIt4cVLD9OQNyLWE1CwfTmBXcoKyXXvzDYpcHz/V+Qe+ONJQ91d4HvDE PGQkO2RketzqtqrwVal5Phbtuhk4ZG4nyBX5pfzyBzo1IOB+eOR54tZbmu+pkCz61NmlGv MWOivYO2RDrBXDARbpoBaK91QG8+VXWmZPKrZ0B1uSrItjhERBhRFPA8pwJMyIzetX2J3R x2A0DCdDIZceW0cGKWxgARjFfgkqJturp+rC5rvsguas6DZGS6k7ykiHVV3qcdfTtQfdNv 9w0+NmnmZFYkmLQFLkY+Nf/BpYQISssTJ204+HMwkniy+VYuKaFeG6O7wxEYzQ== Date: Fri, 4 Apr 2025 11:23:00 +0800 Message-ID: <23fcef43612216d58882c304ec255d2fbb816509.1743736516.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2a01:4f8:10b:392::42; envelope-from=hako@ultrarare.space; helo=mx.boiledscript.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 up extra environment variables for Guix Home. * gnu/home/services/shells.scm (add-shell-profile-file): Skip setup-environment if already finished. * gnu/home/services.scm (environment-variables->setup-environment-script): Skip initializing home profile if already finished. Change-Id: Ife4100c6b19f61272525eebc82931c81784fe9e0 --- gnu/home/services.scm | 6 +++++- gnu/home/services/shells.scm | 6 +++++- gnu/system.scm | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 85a43f80ca..6be1a49a90 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -279,7 +279,11 @@ (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*) ;; diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index bab5730c3d..35c0c52a8e 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -88,7 +88,11 @@ (define (add-shell-profile-file config) "shell-profile" "\ HOME_ENVIRONMENT=$HOME/.guix-home -. $HOME_ENVIRONMENT/setup-environment +# Skip if already sourced. +case $INFOPATH in + *$HOME_ENVIRONMENT/profile/share/info*) ;; + *) . \"$HOME_ENVIRONMENT/setup-environment\" ;; +esac $HOME_ENVIRONMENT/on-first-login unset HOME_ENVIRONMENT\n" (serialize-configuration diff --git a/gnu/system.scm b/gnu/system.scm index 46e6729e74..b67d26b648 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1148,6 +1148,11 @@ (define* (operating-system-etc-service os) esac done +# Set up extra environment variables for Guix Home. +HOME_ENVIRONMENT=\"$HOME/.guix-home\" +[ -f \"$HOME_ENVIRONMENT/setup-environment\" ] && . \"$HOME_ENVIRONMENT/setup-environment\" +unset HOME_ENVIRONMENT + # Prepend search paths not in a profile. export PATH=/run/privileged/bin:$PATH export XCURSOR_PATH=\"$HOME/.icons:$XCURSOR_PATH\"