From patchwork Tue May 20 11:21:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 42766 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 C628027BC4B; Tue, 20 May 2025 12:22:26 +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=0.0 required=5.0 tests=none autolearn=unavailable version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8885727BC49 for ; Tue, 20 May 2025 12:22:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uHL2r-0004zh-TE; Tue, 20 May 2025 07:22: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 1uHL2o-0004zH-Tt for guix-patches@gnu.org; Tue, 20 May 2025 07:22:03 -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 1uHL2o-0007Mu-Jf for guix-patches@gnu.org; Tue, 20 May 2025 07:22:02 -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:Date:References:In-Reply-To:From:To:Subject; bh=56molOm/tvgk8OFj0vxPcTOI1FzQuY3yoGToUT+x7yo=; b=KIKlnCKVROwiLhnZQm14myTCCyQ08il0f9bXfwjtErO7u3i1dy6DPFm22wKSyUBvKp9omoQiHqaHGxka3v6ARfj43r7obaUBstRu5qFZ25Hns8JlNDpGx3i6KbOZEG5kF1zuGK/TZpJu5GbZoTfWk5+D9JMG+iRgLnVoHBp7KiId49gAI//vqmn4cE69q9e1mWyPeyrVTQvHJKitYHH9DVbAcMmgJesS0Yv3qCUe1V/fo88aSHKRCI2RXLELmrU+fLaSuUOZ2OcY8y3waTyf67hqAmnwX2gsDHadhfjOaPlM9pJx6HsOGGJcyPkqnlFWCzgW2XH4IttcI+lOnNc/Yg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uHL2o-00062Q-5i for guix-patches@gnu.org; Tue, 20 May 2025 07:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v3 10/10] news: Add news entry for etc-bashrc-d-service-type. Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 May 2025 11:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78308 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Luis Guilherme Coelho , Rutherther , 78308@debbugs.gnu.org, Julien Lepiller , Florian Pelz Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.174774010623123 (code B ref 78308); Tue, 20 May 2025 11:22:02 +0000 Received: (at 78308) by debbugs.gnu.org; 20 May 2025 11:21:46 +0000 Received: from localhost ([127.0.0.1]:55779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uHL2X-00060p-CO for submit@debbugs.gnu.org; Tue, 20 May 2025 07:21:46 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:48170) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uHL2T-0005zu-T2 for 78308@debbugs.gnu.org; Tue, 20 May 2025 07:21:43 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-60179d8e65fso178223a12.0 for <78308@debbugs.gnu.org>; Tue, 20 May 2025 04:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747740095; x=1748344895; darn=debbugs.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=56molOm/tvgk8OFj0vxPcTOI1FzQuY3yoGToUT+x7yo=; b=FXEWECVipEtPyucv2+pHu0gPoY+VQYm1uW9O1UrT3gRv/zewKw2oJo7CSxZaOWEAPZ WaA67YDSQYJF2ijCArre30ete+jnWIFOnafaqoTsfxb45jOwl8dxKmkhg+uQ0ijdeJfF wkwzcJC1ypfot1H5Kr3zTg1QxMY4xlJ5F+uju/WBY5Wrs8LB0MOV1KCsJoq/S5siOM0F 4FbomQFboZB3w392wiX44aeY/6OHXd6aqkIfYNBG4IuQZaQcZZcUZhFbSKDPIsZui0Wz zYMWs/xwOUKANQ5x3zyUIqotE+z2Y38GZsSZk2sZAbkEQooUjpKlTErXpz2W/3cO3vUS yIVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747740095; x=1748344895; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=56molOm/tvgk8OFj0vxPcTOI1FzQuY3yoGToUT+x7yo=; b=mAcoZTX0aCWA5B2R59/sLyFv/GRUpKfGfQlXGc2I4eyC4Og1NYmtEh5igMvXyPVvsV 2DeXA4A0mzIQBWJmaaSdQEN4k2SLup+8qNnOQTBqWvUeFQwmNodb0dyc5wY5iWSZydYW oVoWKZ46ta3dokxA2spvHi07cExUmQ+xn8BYEtxf2gnElbN3MCUJlu+tdrpybBR/6ab2 qzBS//5mT3PWzPE92sd2z72iZr0w/SF1y6Yz/OoHh0gnQ3SzH716G047TmDXgQNW2c1H UGXncyEVxzuLASAYzJnnvSdulxpQxZH7lpEd95z51hFDv3441+Loz3c54fr9bMeS6IF2 HMXQ== X-Gm-Message-State: AOJu0Yy7yNA7GJD9KEqNBfqkjz+g9X97sMvv+Jfj1KbZnPM6AZrvUwXx U1081550g9sb1qOxPM6symHuLkBqni87bwEvOVpq70oJL19H4vJc/+qJBjXFdOMqb28= X-Gm-Gg: ASbGncuENbPXs4XmhQNDtBY3AAJZAXi29/mJIkaUu2hOLpa7yXbYr5iDcKHlfsOjG/Z 0I4TJGJ/K0UXvexXZ24sRXRSLTVjfL6aoBqWxkTXtkrLhPuEBioE/TbI3VFPK36YP3MOZ5aR9rh zCgg1/RytYe06IYOw+qcc2QPkVI0cTt7Bc6fGaWB26l8EjMyHGxbt7PdUHCRDrAFG4r6e2LdVj+ VzNymg2icqkvS20A0aqdhgvHyyl64+yIKBFDctMQT/vHFp52DyyPgA68zW/ZiMM4vwurr95vWW3 x4NZix6W/dMJcIzCwo45bB1Kp+ZuGPyX3EtpNlWnBc0HYyvY X-Google-Smtp-Source: AGHT+IGmd7p8XwC6gVqXJAJYQWIec7k8+fYqlwl8cfmnCbdU6RHC10PUKf5bPJl5kyksqjyDP8fWVw== X-Received: by 2002:aa7:d399:0:b0:5e0:82a0:50dd with SMTP id 4fb4d7f45d1cf-6009010e9c0mr12084799a12.27.1747740095123; Tue, 20 May 2025 04:21:35 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6005a6e745fsm7183106a12.48.2025.05.20.04.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 May 2025 04:21:34 -0700 (PDT) From: Sergey Trofimov In-Reply-To: <87y0urmz6i.fsf@sarg.org.ru> (Sergey Trofimov's message of "Tue, 20 May 2025 11:03:33 +0200") References: <87h61hknb8.fsf@sarg.org.ru> <87bjrocgre.fsf@gmail.com> <874ixfomwk.fsf@sarg.org.ru> <87msb7buki.fsf@gmail.com> <87y0urmz6i.fsf@sarg.org.ru> User-Agent: mu4e 1.12.9; emacs 30.0.92 Date: Tue, 20 May 2025 13:21:33 +0200 Message-ID: <87frgz4jeq.fsf@sarg.org.ru> 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 Hi Maxim, a follow-up to my previous reply containing my proposal materialised to a patch. From c674d1fdf83bb1bc7930b48f9c0333f2936563d2 Mon Sep 17 00:00:00 2001 Message-ID: From: Sergey Trofimov Date: Tue, 20 May 2025 13:18:29 +0200 Subject: [PATCH] source profile.d as intended Change-Id: I37c0980ca66b2bfb8516df26d3376b16a009f855 --- gnu/system.scm | 10 +--------- guix/build/profiles.scm | 25 +++++++++++++++++++++++-- guix/profiles.scm | 4 +++- guix/scripts/environment.scm | 4 ++-- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 2beca4b6d0..0969228f0a 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1134,15 +1134,7 @@ (define* (operating-system-etc-service os) # Provide a default prompt. The user's ~/.bashrc can override it. PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' - -# The 'bash-completion' package. -if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ] -then - # Bash-completion sources ~/.bash_completion. It installs a dynamic - # completion loader that searches its own completion files as well - # as those in ~/.guix-profile and /run/current-system/profile. - source /run/current-system/profile/etc/profile.d/bash_completion.sh -fi\n"))) +"))) (service etc-service-type `(("os-release" ,os-release) ("services" ,(file-append net-base "/etc/services")) diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm index b19d93f971..a4854386fb 100644 --- a/guix/build/profiles.scm +++ b/guix/build/profiles.scm @@ -98,9 +98,30 @@ (define (build-etc/profile output search-paths) # to this specific profile generation. \n" port) (let ((variables (evaluate-search-paths search-paths - (list output)))) + (list output))) + (profile-d (string-append output "/etc/profile.d")) + (guard-flag (string-append "GUIX_PROFILE_" + (string-take (basename output) 32) + "_LOADED"))) + + (format port "if [ \"x$~a\" = x ]; then\n" guard-flag) (for-each (write-environment-variable-definition port) - (map (abstract-profile output) variables)))))) + (map (abstract-profile output) variables)) + + (format port " +~a=1 +fi + +for i in ~a/*.sh; do + if [ -r \"$i\" ]; then + if [ \"${-#*i}\" != \"$-\" ]; then + . \"$i\" + else + . \"$i\" >/dev/null + fi + fi +done" + guard-flag profile-d))))) (define* (ensure-writable-directory directory #:key (symlink symlink)) diff --git a/guix/profiles.scm b/guix/profiles.scm index 264396401e..68ad6a6bc5 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -2165,7 +2165,9 @@ (define* (load-profile profile (string-append value separator current) value) value))))) - (profile-search-paths profile manifest))) + (profile-search-paths profile manifest)) + (setenv (string-append "GUIX_PROFILE_" (string-take (basename profile) 32) + "_LOADED") "1")) (define (profile-regexp profile) "Return a regular expression that matches PROFILE's name and number." diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 96bbc6c9fa..839ad7ce97 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -1123,8 +1123,8 @@ (define (guix-environment* opts) (if container? ;; The user's shell is likely not available ;; within the container. - '("/bin/sh") - (list %default-shell)))) + '("/bin/sh" "--login") + (list %default-shell "--login")))) (mappings (pick-all opts 'file-system-mapping)) (white-list (pick-all opts 'inherit-regexp))) base-commit: e7d73a08d569904f8a71db5b84f5fafaf0dff188 -- 2.49.0