From patchwork Tue May 13 02:31:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42565 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 7D91027BC4D; Tue, 13 May 2025 03:33:52 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 3A07527BC4A for ; Tue, 13 May 2025 03:33:52 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfS4-0004ft-DI; Mon, 12 May 2025 22:33:04 -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 1uEfS2-0004fI-Od for guix-patches@gnu.org; Mon, 12 May 2025 22:33:02 -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 1uEfS2-00084A-Di for guix-patches@gnu.org; Mon, 12 May 2025 22:33: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:From:To:In-Reply-To:References:Subject; bh=guB94YjzLRAnXEpkwzP6Zr8Mr7TapzYXpUQz1D7PKe0=; b=A9+n8HqIG2DAt5/aU7zjpC+kZWg6sAT3pGqSWn27PJOxV4dYQJFphXApg0bmdZUIarRojDFBKCax638sOJq/K9WsZQ2AtrDDFMP3Sgfuwh5YsvQXZMyWOJa+eWpZzCJJ6jfcERwKiykaPclvU9Kc7/L9uWf952o2jIaxwHn65AuDwZ9MEV02EmdhKWZlwHXlMePbN8VObNBoyEMR7PsG/Vwf4VCJE9sE3NrUGSxD1cslqOIpexvUeMANJnnYrlfVKdj59M9UUwqiGzPvSrbQbev7PtsCE6Wt0iQer9oYhrfHVstUPci9oA5n4s5clLfKVb/hk+0If3Kz1Qp9G+zL0A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS1-0001hq-QO; Mon, 12 May 2025 22:33:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 1/9] system: Source scripts from the /etc/profile.d directory. References: In-Reply-To: Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:01 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035476404 (code B ref 78308); Tue, 13 May 2025 02:33:01 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:27 +0000 Received: from localhost ([127.0.0.1]:56313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRR-0001f6-Ku for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:27 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:42468) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRN-0001eo-W9 for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:22 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7398d65476eso4241952b3a.1 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103535; x=1747708335; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=guB94YjzLRAnXEpkwzP6Zr8Mr7TapzYXpUQz1D7PKe0=; b=aUzCb5QqavYjYBOHeRj06gQj/nZx3qk0WvsVEeYbE9grI5laTLEp3yinb8WnTwnRT/ x9IR3ySLaw6b0L2vMEkKNpOTzSCKzKHEBzy1Xy46ehB2Zl4X2X2fc8vWo5aAavz/iiaI TkteR/gxtq2X6spQ+f4KnV4DHr5eKT8UAfXg3zbXwY1BUWwK6qE2bzWUoioHrTzVYWGI /VDnQ0/GzX99pGQnAGbo4dBqOiLuKgLbq3+3GmeRXvob7305KCJxWL719gfCCRbOwR2A q1+5sxS2U49A7DffKRiFWeYIDy31a4c/Mda7lw8cQidsaauSqumGjqPS5kywdEFu/+zp 6UWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103535; x=1747708335; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=guB94YjzLRAnXEpkwzP6Zr8Mr7TapzYXpUQz1D7PKe0=; b=eCUS6EYjZ5VWnNdiPS5Ec7lfU7uKLSIyLA1cse/ZuUnpIRFopLK1/92kZDlcYz11KT qrsS9ieiGl9tV5Mx/wRueiUTMvLYl6oL9nQPVYdBuSxv2pfoaBpas3rAFuLxYRNCSzvF IcQe3od0jOxd/fL58Q0Gh80JoLFDcevmyCLUJmgR0W44xwwM2DJbhf3T6VH6x+SMQPfH ky2B6N6tPKoWv8xN+E2URiMfZiu0B3J3Zt6WbQ70fHfA0PNQ1p1muMRTscIEFYzsPCOF bTqCtzFNv+aOWlmgpiOQymuSRYPHGBuMKurl8LaSRD5RR7Q+X+wc7yJDjVvZFQmrYek5 33Kw== X-Gm-Message-State: AOJu0YwCxnMJ5hJGc0i1bg5Vb9og1OkWNY1zCK2HQkbrBR3JFHG6W7zA ON16a5n7v9e4oDZSqKyxJwb70nJ0qrrU+Bl7ehBzkipM0I0tOxtlrXgLEi+p X-Gm-Gg: ASbGncvcRPNAX+wtWYJmLh6awzaomYOLjZjY2n1/k6PsCQlfPkkoe/waN4KykkL8EdB PMnj1J4Bp5s4b8wZRmWUsv5OkSp+o8fFu2i/ImwPYGGbwQ7No5UsYrt1DUiGNaTxRMtHpR5xsU/ /Yn1DX0E5zoPEFWbZt9S8VPF0vx0g1iV8afr9gg33YekbEEpxY+OIaDUdL6yhz4Pj/lquDks36k Y0B7v8EOP1uMQJNM6A+YuTT3S9x3xDenuGGT+ez4X/NseSTML4PCU82E88jq6n42D8IBcXcATyY xkDDCdA7WukD+Id22DQF4wKzNXh01Q8wsdie9sQNaijU1lhBLc7CcQ3RIFmJxbDMLfDHPF8= X-Google-Smtp-Source: AGHT+IGtn51FEa9f4Uv6Ms83aLiyifTrgGZ0JEu+Zp/oZaqrqZ2fZxEDD2/YUvRI5aU6Cs2hRddzYw== X-Received: by 2002:a05:6a21:a45:b0:215:d1dd:df4c with SMTP id adf61e73a8af0-215eb7262eemr2516619637.6.1747103534670; Mon, 12 May 2025 19:32:14 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:14 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:40 +0900 Message-ID: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 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 This is useful since our /etc/profile file is otherwise not easily extendable. * gnu/system.scm (operating-system-etc-service): Source all '.sh' ending files found under the /etc/profile.d directory. Change-Id: Ia6d777195241f69219f00fbd5975e3e6b7c265fb --- gnu/system.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) base-commit: 364694773ef1c61d4c9ec73e24f73642786486ca diff --git a/gnu/system.scm b/gnu/system.scm index 2beca4b6d08..7db0ff5ba5e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1122,6 +1122,17 @@ (define* (operating-system-etc-service os) # Allow GStreamer-based applications to find plugins. export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\" +for i in /etc/profile.d/*.sh; do + if [ -r \"$i\" ]; then + if [ \"${-#*i}\" != \"$-\" ]; then + . \"$i\" + else + . \"$i\" >/dev/null + fi + fi +done +unset i + if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ] then # Load Bash-specific initialization code. From patchwork Tue May 13 02:31:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42567 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 CBDB127BC4B; Tue, 13 May 2025 03:33:57 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 1EF3527BC49 for ; Tue, 13 May 2025 03:33:57 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfS6-0004gw-Az; Mon, 12 May 2025 22:33: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 1uEfS5-0004g4-0C for guix-patches@gnu.org; Mon, 12 May 2025 22:33:05 -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 1uEfS3-00084V-Vr; Mon, 12 May 2025 22:33: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=sr8i9WlrVK6qoTRljMxFioJyNQBxdICkoH6x/AADZdw=; b=ZhGvRX1CpTsBjJ/CzciC1oxcEoRAViZSVKGAFrKtMSdpHNqIxIOiVBfPk31bguLf1IDjHV1dVs3Z3zHCd2BWCxMmJ0k+ZDi0cTzmMk0hlj6hu+59GQxNDGVG+1bUax5wR18bHpZiZ6WvB8HTTT3heV7mL5NomMWhyKWUzllFS0xoispTLkVyKGqj6TOSfOteRMOy0l0BK+XV8Zk3BGsD32eon6BP1054Qbh/V1wlghAUtL4fAjWMfY04U3CzCVyanmMp/N+jNYyQXC2+5mZDFlcn5w4OHlY4r4Q+pO8FRJt7xZTModgR8KrnwEsEC3DbGKZHNQvNIvM1dSqnn6UXlA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS2-0001hy-8y; Mon, 12 May 2025 22:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 2/9] services: Add etc-profile-d-service-type. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, gabriel@erlikon.ch, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33: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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035556437 (code B ref 78308); Tue, 13 May 2025 02:33:02 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:35 +0000 Received: from localhost ([127.0.0.1]:56317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRW-0001fT-CE for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:35 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:47419) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRQ-0001er-Ea for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:25 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-7423fb98cb1so3285550b3a.3 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103538; x=1747708338; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sr8i9WlrVK6qoTRljMxFioJyNQBxdICkoH6x/AADZdw=; b=aFx3wvP0W3ob9fodA4OhikpfJiz1QW4LS2SqWBQLlYHNRvIb0s8ol6lRqzR0oYBo/V 3n0XR5E31whdBftW33YjL0t71ZLJjnxacpOJSV07+gRRwK/boRgl/i6seD9i6pWS0wUs RzA5GlKRn6lXWI76VHuqt6meGUfUXesVBnJyj1sB4uNSwwLAa3bxiyPdOL3HSBjXOc0t hVHPpF783NQAjosASVyfPPsRNqCosk8i33UsfBTJGC88NZ3Ni0HevWYT0a7wub2GTQy/ FyPDlkLv4vebDWHqbM+umoBMquznszX66v54t391N4ESQFygO0Vo/KhOcxXYafTatjLq 6tAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103538; x=1747708338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sr8i9WlrVK6qoTRljMxFioJyNQBxdICkoH6x/AADZdw=; b=mMLa7sIj9Tw3O2sMsHBtrWwG5o7eE8EISXaaiCZq3XmNpyqBRGG3mAgMoW1WSoC9Pk jm5i7oG7/o4u9thHPGkqDW++ZD60z6/GtwGIkwvuhNRbx5kOcb6L708jiEwrGWcKBLwE okF7JN46UoIa4TvyhRdLRmKOAUPldA6CH6B9Cy9VIGBPMxDuEp6hyhw7xy5WDEO8tcZS a/oFQq3g6Ukg9TDwoxWwapvC+Gwgij1o8AbgQWPWToNE+XY3Hz7rqgDAM5VNx2dOADPg AmeBlkVxBeWBiNki7sBmxoG9PPvIQnV50PsKcITHMmd3CMCsUsPIuSb3h/gzuD2+NRal 1+CQ== X-Gm-Message-State: AOJu0Yz3wpOTqzZ7XdzDcn5+q7pynsJkMUXkXCgLLWcG1vUDvCYBwddp AWhumATBU59lNZ2RouL+EbWFyWrK1XLfCMnBx49t6A2o3garv0mN4o/JnPf3 X-Gm-Gg: ASbGncv5JTKkCQn03vzlo1PhI4tlu+vYRoLmdz3PMAbfdkGurb20R5B3oDxPrFjsyYW LK4XPIOO5gPH99dGgpWa0StkT79v6xl26CWiSFnundrC08YzzPkW0pGi5uAMjgsB44YM/9mJha1 W8k4aks76yqu7fw6hpHcivPsW+wWnDY533ujAvQ/PKPceI8hO681rP2Ww8FdbJdiilEunxTsDtw HVr6YgvU6d/a/IXVleachnEnWx9bSwPQO4Tu/Rcp4WMM+hpWZpUUn/ELjd/b+zUDG12o9ntpPba mjOA6q0salQ2TiiK3+bHl07duZBFEGI1LoThmNqBESCMXAi3eithjpm6a8yCaC8sEoHfkKM= X-Google-Smtp-Source: AGHT+IGULyFZG4xvMPkKi3sars85caOzp5DlPZT43pUAIBycblHu2h1PuV/bnRo55J/Ylpww9HUghQ== X-Received: by 2002:a05:6a00:148b:b0:736:a540:c9ad with SMTP id d2e1a72fcca58-7423c073074mr21735549b3a.20.1747103537608; Mon, 12 May 2025 19:32:17 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:17 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:41 +0900 Message-ID: <1492757e33cc1159cde8a144cbaeca783c1012f1.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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/services.scm (make-files->etc-directory) (files->profile-d-entries): New procedures. (etc-profile-d-service-type): New service type. * doc/guix.texi (Service Reference): Document it. * gnu/tests/base.scm (run-basic-test): Test it. Change-Id: I45dde43a1b9603c3384b933ebd1d6e45dba146b9 --- doc/guix.texi | 16 ++++++++++++ gnu/services.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++ gnu/tests/base.scm | 21 ++++++++++++++-- 3 files changed, 97 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 34092a2f735..2f80b2a0296 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47556,6 +47556,22 @@ Service Reference pointing to the given file. @end defvar +@defvar etc-profile-d-service-type +The type of the @file{/etc/profile.d} service. This service is used to +create files under @file{/etc/profile.d}. It takes as value a list of +file-like objects, as can be produced with @code{local-file}, +@code{plain-file}, etc. Note that provided files whose file names do +not end with @file{.sh} are @emph{not} added to @file{/etc/profile.d/} +and are silently dropped. Package objects can also be provided directly +to have their @file{etc/profile.d/*.sh} prefixed files added. A simple +usage may look like: + +@example +(service etc-profile-d-service-type + (list (plain-file "youppi.sh" HOW_IMPORTANT=very"))) +@end example +@end defvar + @defvar privileged-program-service-type Type for the ``privileged-program service''. This service collects lists of executable file names, passed as gexps, and adds them to the set of diff --git a/gnu/services.scm b/gnu/services.scm index af054339fd9..8584b16ac5c 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2022 Tobias Geerinckx-Rice ;;; Copyright © 2023 Brian Cully ;;; Copyright © 2024 Nicolas Graves +;;; Copyright © 2025 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,6 +27,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services) + #:use-module (guix derivations) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (guix store) @@ -120,6 +122,7 @@ (define-module (gnu services) special-files-service-type extra-special-file etc-service-type + etc-profile-d-service-type etc-directory privileged-program-service-type setuid-program-service-type ; deprecated @@ -926,6 +929,65 @@ (define-deprecated (etc-service files) FILES must be a list of name/file-like object pairs." (service etc-service-type files)) +(define (make-files->etc-directory name) + "Return a procedure that accept a list of FILES and compute a directory named NAME. +The returned procedure FILES argument can be packages containing +@file{etc/@var{name}.d/@var{x}.sh} scripts or single file-like objects of the +@file{.sh} file extension. The constructed procedure returns a list of +two-elements list suitable for extending `etc-service-type'." + (lambda (files) + `((,name + ,(computed-file name + ;; This is specialized variant of `file-union'. + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (ice-9 ftw) + (ice-9 match) + (srfi srfi-1) + (srfi srfi-26)) + + (define sh-files + (append-map + (lambda (f) + (let* ((dir (format #f "~a/etc/~a" f #$name))) + `(,@(if (file-exists? dir) + (map (lambda (x) + (list x (string-append dir "/" x))) + (scandir dir + (cut string-suffix? ".sh" <>))) + (if (string-suffix? ".sh" f) + (list (list (basename + (strip-store-file-name f)) f)) + '()))))) + (list #$@files))) + + (mkdir #$output) + (chdir #$output) + + (map (match-lambda ;XXX: adapted from file-union + ((target source) + ;; Stat the source to abort early if it does not exist. + (stat source) + (mkdir-p (dirname target)) + (symlink source target))) + sh-files)))))))) + +(define files->profile-d-directory + (make-files->etc-directory "profile.d")) + +(define etc-profile-d-service-type + (service-type + (name 'etc-profile-d) + (extensions (list (service-extension etc-service-type + files->profile-d-directory))) + (compose concatenate) + (extend append) + (default-value '()) + (description "A service for populating @file{/etc/profile.d/} with POSIX +scripts having the @file{.sh} file extension, to be sourced when users +log in."))) + (define (privileged-program->activation-gexp programs) "Return an activation gexp for privileged-program from PROGRAMS." (let ((programs diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 20fc848e5ce..988212b4a7a 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016-2020, 2022, 2024-2025 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur -;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022, 2025 Maxim Cournoyer ;;; Copyright © 2022 Marius Bakke ;;; Copyright © 2024 Dariqq ;;; @@ -170,6 +170,14 @@ (define* (run-basic-test os command #:optional (name "basic") info --version") marionette))) + (test-assert "/etc/profile.d is sourced" + (zero? (marionette-eval '(system " +. /etc/profile +set -e -x +test -f /etc/profile.d/test_profile_d.sh +test \"$PROFILE_D_OK\" = yes") + marionette))) + (test-equal "special files" '#$special-files (marionette-eval @@ -563,7 +571,16 @@ (define* (test-basic-os #:optional (kernel linux-libre)) (let* ((os (marionette-operating-system (operating-system (inherit %simple-os) - (kernel kernel)) + (kernel kernel) + (services (cons (service + etc-profile-d-service-type + (list (plain-file + "test_profile_d.sh" + "export PROFILE_D_OK=yes\n") + (plain-file + "invalid-name" + "not a POSIX script -- ignore me"))) + %base-services))) #:imported-modules '((gnu services herd) (guix combinators)))) (vm (virtual-machine os))) From patchwork Tue May 13 02:31:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42568 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 118E827BC4B; Tue, 13 May 2025 03:34:00 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 8721D27BC49 for ; Tue, 13 May 2025 03:33:59 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfS5-0004gR-Ac; Mon, 12 May 2025 22:33:05 -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 1uEfS3-0004fQ-IN for guix-patches@gnu.org; Mon, 12 May 2025 22:33: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 1uEfS3-00084M-9w for guix-patches@gnu.org; Mon, 12 May 2025 22:33:03 -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=0MLMMcxxWctW/jlInP2ZCILiRjJc3AJ1xuGwWzje7Pc=; b=fAeF5j+6+gdWMKPT5eMrgUN/k1XuecbcyxWSsh/mO82kIAR2pKTwyNthPw6bAfJwwvnV8aOyGv5E20EiM4+Nupwim4XtUevy2W/s+4Mgdlnuq2Cb61G02VTMK3zONY3S1mY5WRRV7OYDPL28Qb+JOZMkEgIp+IX0PacY+EU6k7v80P8L4VHQ++ulscrB03syNQLZXvDtTrHM8rM7qqJHk2YOVUf/2z2kujB6vg3ZxoaLR19FJGSmEW2W7U4sIx43gRGV+gUdKG92bzlrTvvzKPzECe8trcu1IF5E6oIEDshOWT7fy0eRI0Uvy5VpNHvwc7GBM5qcfy9F6AXAIxf3vg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS2-0001i6-OX; Mon, 12 May 2025 22:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 3/9] gnu: bash: Define the SYS_BASHRC macro. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33: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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035566451 (code B ref 78308); Tue, 13 May 2025 02:33:02 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:36 +0000 Received: from localhost ([127.0.0.1]:56321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRb-0001fs-TU for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:36 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:44116) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRT-0001eu-1A for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:27 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7423fb98c5aso2911679b3a.0 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103540; x=1747708340; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0MLMMcxxWctW/jlInP2ZCILiRjJc3AJ1xuGwWzje7Pc=; b=jCuwMDHRw/Aly4/u4KvktMOdoIMC+76zPT9SVTCkGZs7x2SaXxvnqkGZ/PFELHWbpc DnHiWEgZwZl7L9soD1F7npXLp4mY6/jK1+gcXAHaQDOUGta9h0rrqDniDhfFsoX8w9Bb cUFyT8ec4iRUt0UOw6Y6B1x3vSxXZtuisZafHQgwbMqo5Mo8whvf8c7lTz//Qo6uFv3Y D/dLYXO8unXm+hTcLrL6+SeRigubxywxRqViacnEsPMFA9oP9u7zsuJeAXjQPM8y57fU u+5MZXQ109RDySB9RH/2ZRXybaBhreizPjnYsJ9JjXQRDo1en4jLeNNGcglAYB42C1qb SMIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103540; x=1747708340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0MLMMcxxWctW/jlInP2ZCILiRjJc3AJ1xuGwWzje7Pc=; b=TZEWh6Ls57CecyRfAzi/VbGDAVAqTNGhAaVPIMETvKM3KbiDPUnoETL1NgycX+RjIW gHPdBBz2MqlumGojlHsuqh63H5CrZ6Cgn9016rs2OkwD1uJc6pki6DTtOX2qZWbBOkrU wb1x6Z+JcY9KC61zvV3EcjcinsD1V3vVwTqN4nwns94vBwTgEsH7QNfs77TrvXJZLvOs WU8hNg1OM+1SAiaM/Gf09k8ePRNk45H2AR0D9M6FEYvNKjWx482ZaJQktqMmrqhdJOZM RW73ptXoX4PjcvWwrB6wq+0mtCf9IGwViMBlH7lOZnJ64g02o2V8g/qoGoH4nrtAXrj0 ncIQ== X-Gm-Message-State: AOJu0Yx4gvpr31GNQmTgjVFBMMd4MI7/gnb63QxBzUgFP/staql3XUOg DTXYKqui6/QLzodseYxPGw0QVbBJ5hD8aURcbTTu3GSr+9MBD7agvWXCNz1W X-Gm-Gg: ASbGnctZEOu+YqgK1I5KZwPUJPtYy/tQ7PmzsySn10P1MpXabb/Ox9/gr+ET6B4qb31 U+fxeVwl3Pf/+YSKpMZnu+5Y9my8Vt5HyIxjm4Kk6zCHqCHm7sUxqWavh6sKgxD0KcKEXZrn9Qt zcaIjPIeT1jb/73ZYDSOIvop7Y0grpNFbETzQdNNw+1x58SoK6uInKlPqsGA2x65Pes1Yp1BK6+ BAA/eOKcX2xxnO3kNe3s54MkdPOpUT0jtuDPHp/w9fQYepSWN82RGuS++WF00ZX/tU1bxNdj9Oc dgVyLn9KMN0pe8Tl5ylyEkRk0SKVBoo3gC1IpI+I4lQGKsVXciTaFzEuA2xzMOOPzu2TExYQklm YLkClrg== X-Google-Smtp-Source: AGHT+IE0CmbVYXfqbFg/v8BlcH8n2V73YbN7qjy1aS1wdPPRTb0OhLxnruWwE6eSNVQG6Q7fRo4ONg== X-Received: by 2002:a05:6a00:1253:b0:736:a82a:58ad with SMTP id d2e1a72fcca58-7423c054153mr21684228b3a.15.1747103540432; Mon, 12 May 2025 19:32:20 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:19 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:42 +0900 Message-ID: <58b6781fd2f0184f4f3c82bc85f84df9220acc43.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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 This causes Bash to treat /etc/bashrc as a startup file, removing the need to source /etc/bashrc from ~/.bashrc. * gnu/packages/bash.scm (bash-fixed): New package, with added SYS_BASHRC define. (bash) [replacement]: Use it. * gnu/system/shadow.scm (%default-bashrc): Do not source /etc/bashrc, now done implicitly. Change-Id: I5b0afd7d81653ef19c482e5501efdf7e50ef37c0 --- gnu/packages/bash.scm | 20 ++++++++++++++++++++ gnu/system/shadow.scm | 3 --- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index c88f38f5376..bcd78d7d2a9 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2024 Oleg Pykhalov ;;; Copyright © 2024 Janneke Nieuwenhuizen ;;; Copyright © 2024 chris +;;; Copyright © 2025 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -137,6 +138,7 @@ (define-public bash (version "5.1")) (package (name "bash") + (replacement bash-fixed) (source (origin (method url-fetch) (uri (string-append @@ -254,6 +256,24 @@ (define-public bash (license license:gpl3+) (home-page "https://www.gnu.org/software/bash/")))) +(define bash-fixed + (package + (inherit bash) + (arguments + (substitute-keyword-arguments (package-arguments bash) + ((#:modules modules '%default-gnu-modules) + (append '((ice-9 receive) + (srfi srfi-1) + (srfi srfi-26)) + modules)) + ((#:configure-flags flags) + #~(receive (cppflags flags) + (partition (cut string-prefix? "CPPFLAGS" <>) + #$flags) + (cons (string-append (first cppflags) + " -DSYS_BASHRC='\"/etc/bashrc\"'") + flags))))))) + (define-public bash-minimal ;; A stripped-down Bash for non-interactive use. (package/inherit bash diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index d0f1b6b2b14..50ac102707e 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -164,9 +164,6 @@ (define %default-bashrc return fi -# Source the system-wide file. -[ -f /etc/bashrc ] && source /etc/bashrc - alias ls='ls -p --color=auto' alias ll='ls -l' alias grep='grep --color=auto' From patchwork Tue May 13 02:31:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42566 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 E02C527BC4A; Tue, 13 May 2025 03:33:52 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 374CE27BC49 for ; Tue, 13 May 2025 03:33:52 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfSA-0004iT-On; Mon, 12 May 2025 22:33:10 -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 1uEfS4-0004fw-Gi for guix-patches@gnu.org; Mon, 12 May 2025 22:33: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 1uEfS4-00084a-5x for guix-patches@gnu.org; Mon, 12 May 2025 22:33: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=j03xWHbz4JV5trI7wo+BpJ6PqmseEA+uaoCK6e3ezuY=; b=fxHsU/7KOZLpykzphZs97ALShrqKSvBGv/OaKOAFzs5ziWNmyvDn5s+CMDPptA6K1rzgY5jXVyJeKxVtZvBUdtSRVqxfL9jrszHp/HolCYvH+IX7HO5PfPoPQwL/nwphFSpZt/WiJqUkoBep67TErt+//Mmb6yGHCUU1Pw+hc6rCwEzNOB4nDDBPgZ/hrQoFvwrXGJTeiYIUWUltaybTOczmwYNb6hSQ3fWoxM8qLq8h3QC0bzyX8AG6CTNaUlssMgLpdfo0NLWgcH0wOdFhSJsVvaaVDi9oiS/3nXztOwUki/OenvJm7F552vE/mnyrMUGMf+17lQD0obaBpAw2/g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS3-0001iE-9F; Mon, 12 May 2025 22:33:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 4/9] system: Source scripts from the /etc/bashrc.d directory. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:03 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035576461 (code B ref 78308); Tue, 13 May 2025 02:33:03 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:37 +0000 Received: from localhost ([127.0.0.1]:56323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRc-0001g5-Gr for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:37 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:61605) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRV-0001f4-Tj for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:31 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-7424ccbef4eso2532496b3a.2 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103543; x=1747708343; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j03xWHbz4JV5trI7wo+BpJ6PqmseEA+uaoCK6e3ezuY=; b=U7P3h7Qoa56mNR9rOI7I5BehcqHV36QNePK7+UGr1HQaLDE7Ud/Rdx2Tqj3EKgtbFq 8+A+5Qkgt524zsu1ucwvFaWXSUT8nkz8cvLJfpCeR8hGUT03V//sApZQQgFVL+a+PJxF HbZw6IgGGuJUF7feYtjC7Shahv5mHjsiodBTlDIGf/2WBSRX+xvDDiMGqiBX6XgphcCY Lf2ngoLkaSPqQuRKCtThGpcEyfMLkzjHU3r8Ju4+264y5Bs0KaTwOK+ANNtmD4JJsu53 VnEOQPwMToPvXGh/LIusuEVvVTtI6LR0PVAxBZJx15HZy7yOK8owRBy/YjQg/Ug8pI01 I59g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103543; x=1747708343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j03xWHbz4JV5trI7wo+BpJ6PqmseEA+uaoCK6e3ezuY=; b=PcLF7VMVehal58iBN15Nzr1ZI+WqlHJrOnX54Hx/Poq+kTzRo8qXhMQekzZO5k92Ua VXqlXA36HNGjUJFzG5JXGcLlu0CoFLQHVNDCP8w3mz/osyJ5y/dIyKftFD8LOEntfNYL u1Pj9RppxJ7OYaT0DltchlmYD+dZzmvIoL6DDWaEPdQ0BVYsY9BjwYJYCfZqxcdy/4mT 4LeLiy6sAORuMFhI17Rrc8XTdx8/XuFFrpynJUB+zLrytXzYpAgJzmnrYvk89a6bO5Ga eRklo/boRFW/ehGNSl6cTScSSDsLdkEZfU0i5TGbwVJK4RghQU7JtEbWbvXNmz2koRxS GcnA== X-Gm-Message-State: AOJu0YzbtWwbQWRhy1Py9rH4LDd8kuN96Zeb9Nr4QLg83DxmCPsS19ej CmY2Mqk6IAhEO3mPfH4ev7o5BoVufR03g+uuGHW7lidBj78mxDGnYO0KeS81 X-Gm-Gg: ASbGncsdiyH4TUx1oETYWFKW9ymR1l5584bjSOFDGlJ/v45VYMcOYI/iYWmDSw8KWwc He+vsZFM2+GQkWLAFHuMFtPYZ0/s27jVbvTJqIEQ3QnknIe6DS+OWDNYNU7acjqVfHKKwW/qLwF PG5AC0GthDdC35Ec4oNyAQMwU23VwS5+ucmDn4+SpJ1J7OMSH+EQa2dVACOA3tAXavkj/31owCq qKUc7nrXAJEoDkxaCuohrNVjwqAKYsYSX53I6WSrKMHo65dT0sjMwxfLSG2roAV2iIvYpLHt7kW d9jRbIyiLCpdnur5HlbVF5RqgjyfFsezUizHB8vJjDY89kNasZE+yDuWdZucMDFePc8uOv84Q7N pXspLJA== X-Google-Smtp-Source: AGHT+IGIqLLA4mlbAKQ1UIl0f25O2dk3xZp3kotOD1VagclTjDT4yGD1VL0WLBHViBzNpxY8CwisOg== X-Received: by 2002:a05:6a00:4b53:b0:740:9c06:1cff with SMTP id d2e1a72fcca58-7423c0163dfmr22055757b3a.23.1747103543255; Mon, 12 May 2025 19:32:23 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:22 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:43 +0900 Message-ID: <19720935b288333559f31a7b4f818d8607923500.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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): : Source scripts from the /etc/bashrc.d directory. Change-Id: I27a20a8eae5d736f32e0df55a68529d9bb613b7a --- gnu/system.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 7db0ff5ba5e..0b64927f5ba 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2020 Danny Milosavljevic ;;; Copyright © 2020, 2021 Brice Waegeneire ;;; Copyright © 2020 Florian Pelz -;;; Copyright © 2020, 2022 Maxim Cournoyer +;;; Copyright © 2020, 2022, 2025 Maxim Cournoyer ;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen ;;; Copyright © 2020, 2022, 2025 Efraim Flashner ;;; Copyright © 2021 Maxime Devos @@ -1153,7 +1153,13 @@ (define* (operating-system-etc-service os) # 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"))) +fi + +for i in /etc/bashrc.d/*.sh; do + [[ -r $i ]] && source \"$i\" +done +unset i +"))) (service etc-service-type `(("os-release" ,os-release) ("services" ,(file-append net-base "/etc/services")) From patchwork Tue May 13 02:31:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42562 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 D390327BC50; Tue, 13 May 2025 03:33:35 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 E0B5427BC4A for ; Tue, 13 May 2025 03:33:33 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfSA-0004iR-Kv; Mon, 12 May 2025 22:33:10 -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 1uEfS5-0004gQ-9j for guix-patches@gnu.org; Mon, 12 May 2025 22:33:05 -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 1uEfS4-00084n-Vn; Mon, 12 May 2025 22:33:05 -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=Cvm1CPKNn9jHDNUZDZk3UuleRAtzamqhVw6D97Z+UUY=; b=Tz3paQeFJchjza19H2NBcD/obSm3ahZ6cU46fxABGzBWev7eEbakMC0zlgZiNN2ucclcIfobKg2bbLOzwlsxVVM8B1y6yzgzWpDkzMpNidMu4SiDlLyOlDq/DjysmSAsauPGB+6ntsY/Zgu3wi6ao71rjKusFQ+RXeR9mg6YbK25+vYK6r2JumyETtwJSUNgIECCVeO+NbtFhqOD1urF6wPUfx1js8k6grUs2mLWA3xJvHfHTvuOmwq/SxDjuaZ+FFlqmkacg2G3RDXr0iB0628Y7htBBg1XmveO918ewOD+HG3eJO9Q2zfX8UjYcjc+N5/PsrsrNAVkNehu+f6agg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS3-0001iP-RM; Mon, 12 May 2025 22:33:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 5/9] services: Add etc-bashrc-d-service-type. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, gabriel@erlikon.ch, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:03 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035576467 (code B ref 78308); Tue, 13 May 2025 02:33:03 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:37 +0000 Received: from localhost ([127.0.0.1]:56325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRd-0001gA-8P for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:37 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45521) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRZ-0001fE-BC for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:33 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7426c44e014so1567050b3a.3 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103546; x=1747708346; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Cvm1CPKNn9jHDNUZDZk3UuleRAtzamqhVw6D97Z+UUY=; b=b19eSBn0tk3lyreN0oVMC17z9/hmOiuiuND517MsOzp1Bf9aHZI20wd7EkFxNIFQQB szYBpXcHYJt1sbipKzWRXlxrNBckBiy91lm40mpdatJNG4esX7pHsiYRFI3uiIimzVKI adxRTTRDs9bnCKUCyiUfBaOGJfYvTxa+yKWID7ASenD33p/duVxi08COysXacLy5BMOE WzmqmLbbfPjP6F/jEXgeS5EWw/h8sb4RxrnGhCYJuOgjJyr2I5QymhLD/71AWWFCaCjy WnlwQ3GWQguA8JlVSewwfZFjP7RM+oYecm56Gxt/DVOO98noLd+Sew9e5KiOPV1Frjer mHCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103546; x=1747708346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cvm1CPKNn9jHDNUZDZk3UuleRAtzamqhVw6D97Z+UUY=; b=H+qmfUpLyhQ9Iz+OAdlrRNMcKLcH/LnfqXGYUOH3RqTydcfdQNSmfALriCYnv8YCMO 9c2zjCBeFI8UeLxdFsjwA7meXoiZW82wEi7xqux1NE0m78I+qyNhLYgHStM+BJ4/48G2 K/k3md8u6NtgGWCsERY8JhANZLFvR9b21gsxFMs2KxW1ZGplI/GlmFYMOFIO3GY6Jnge E859dJiUfdbVLohZbs7a+NRJx7EhV8yTDYx9w+bWL6OuQQiWtlTsKAJO6ken1TmkcSL8 wg76ZkN1THelZRV87FFDrU56Gw7bZe3r4rtyTBafgO+dnCJCNswxYXw9nvxRGl3JSv46 qcHQ== X-Gm-Message-State: AOJu0YySeTZEpT8PzrQea6CM5cgcCDaUFR6uaJKoLyZCOPP9QjaYAQau fozkB8D0MwWpbYUpTCkmZGjsY3DmZ69qzsdcNNQVIG30drUqv7s8i5w/JnKa X-Gm-Gg: ASbGncvjanXrsDKdcIYXjs6jAr/PbztRWwXuPcT3elJde5dEFONKyX+oaL89YC5rZ6s xQqzkxV/1PjkAbq6IaP/eH/cgnSDNY0pDAekrWcakOgR/NHa6y2wkEME0fAMY6lIPHLDRbkSlIw RGavVFp1Pln6BEEz+94CnEpUE1LlTG89bizdg5SfrrMy+kfR103QXtHrCz51n6zY0PJj6EJ7aj9 HW4UDB19mfyqZEl1ksuocW4dFfyYvhXshzVT2KWQSdk6cC7et/EVUN0ImfnobVRvybq3eBYHgmp IraQU4FWzmnc7cIK97X5PpcUlRI6uy21muSvRdaSC3aIGkTaOfLgCTHBg1C9f5lZ4BD7R9g= X-Google-Smtp-Source: AGHT+IH47td4drjSFhri6FRy0SL03kWV/9WsLnf+8QHPMAz392115omO8oBvkoY3uaDY/DeeHic4xg== X-Received: by 2002:a05:6a21:3a8a:b0:1f5:87ea:2a10 with SMTP id adf61e73a8af0-215abacf107mr22052056637.9.1747103546153; Mon, 12 May 2025 19:32:26 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:25 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:44 +0900 Message-ID: <761645138055776938dc22fd9b78209b168cb00e.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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/services.scm (files->bashrc-d-directory) New procedure. (etc-bashrc-d-service-type): New service type. * doc/guix.texi (Service Reference): Document it. * gnu/tests/base.scm (test-basic-os): Test it. Change-Id: Ibbb0f684de7aee296adedbce5b1192786d661af2 --- doc/guix.texi | 18 ++++++++++++++++++ gnu/services.scm | 14 ++++++++++++++ gnu/tests/base.scm | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 62 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2f80b2a0296..559896ff3a1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47572,6 +47572,24 @@ Service Reference @end example @end defvar +@defvar etc-bashrc-d-service-type +The type of the @file{/etc/bashrc.d} service. This service is used to +create files under @file{/etc/bashrc.d}. It takes as value a list of +file-like objects, as can be produced with @code{local-file}, +@code{plain-file}, etc. Note that provided files whose file names do +not end with @file{.sh} are @emph{not} added to @file{/etc/profile.d/} +and are silently dropped. Package objects can also be provided directly +to have their @file{etc/bashrc.d/*.sh} prefixed files added. An example +usage may look like: + +@example +(use-package-modules gnome) ;for the `vte' package + +(service etc-bashrc-d-service-type + (list (file-append vte "/etc/profile.d/vte.sh"))) +@end example +@end defvar + @defvar privileged-program-service-type Type for the ``privileged-program service''. This service collects lists of executable file names, passed as gexps, and adds them to the set of diff --git a/gnu/services.scm b/gnu/services.scm index 8584b16ac5c..7083c88c130 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -123,6 +123,7 @@ (define-module (gnu services) extra-special-file etc-service-type etc-profile-d-service-type + etc-bashrc-d-service-type etc-directory privileged-program-service-type setuid-program-service-type ; deprecated @@ -988,6 +989,19 @@ (define etc-profile-d-service-type scripts having the @file{.sh} file extension, to be sourced when users log in."))) +(define files->bashrc-d-directory + (make-files->etc-directory "bashrc.d")) + +(define etc-bashrc-d-service-type + (service-type + (inherit etc-profile-d-service-type) + (name 'etc-bashrc-d) + (extensions (list (service-extension etc-service-type + files->bashrc-d-directory))) + (description "A service for populating @file{/etc/bashrc.d/} with Bash +scripts having the @file{.sh} file extension, to be sourced by interactive +Bash shells."))) + (define (privileged-program->activation-gexp programs) "Return an activation gexp for privileged-program from PROGRAMS." (let ((programs diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 988212b4a7a..edb7e9112ba 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -178,6 +178,19 @@ (define* (run-basic-test os command #:optional (name "basic") test \"$PROFILE_D_OK\" = yes") marionette))) + (test-assert "/etc/bashrc.d is sourced" + (zero? (marionette-eval + '(system* "bash" + ;; Ensure Bash runs interactively. + "--init-file" + #$(plain-file "test_bashrc_d.sh" + "\ +. /etc/bashrc +set -e -x +test -f /etc/bashrc.d/test_bashrc_d.sh +test \"$BASHRC_D_OK\" = yes")) + marionette))) + (test-equal "special files" '#$special-files (marionette-eval @@ -572,15 +585,23 @@ (define* (test-basic-os #:optional (kernel linux-libre)) (operating-system (inherit %simple-os) (kernel kernel) - (services (cons (service - etc-profile-d-service-type - (list (plain-file - "test_profile_d.sh" - "export PROFILE_D_OK=yes\n") - (plain-file - "invalid-name" - "not a POSIX script -- ignore me"))) - %base-services))) + (services (cons* (service + etc-profile-d-service-type + (list (plain-file + "test_profile_d.sh" + "export PROFILE_D_OK=yes\n") + (plain-file + "invalid-name" + "not a POSIX script -- ignore me"))) + (service + etc-bashrc-d-service-type + (list (plain-file + "test_bashrc_d.sh" + "export BASHRC_D_OK=yes\n") + (plain-file + "invalid-name" + "not a Bash script -- ignore me"))) + %base-services))) #:imported-modules '((gnu services herd) (guix combinators)))) (vm (virtual-machine os))) From patchwork Tue May 13 02:31:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42569 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 F2E0327BC4A; Tue, 13 May 2025 03:34:01 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 376B727BC49 for ; Tue, 13 May 2025 03:34:01 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfS7-0004hI-Ci; Mon, 12 May 2025 22:33:07 -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 1uEfS5-0004g5-1U for guix-patches@gnu.org; Mon, 12 May 2025 22:33:05 -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 1uEfS4-00084f-HG; Mon, 12 May 2025 22:33: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=K1zgxA3JygQVWUgyv8FXtsicDjog+fJkdeoHSsxm4Fs=; b=qlamRDMc+WuDTvFPUzOU2hHIFsTiqozhSPykd5LL8bs0e3Vty8Ys4hfI9vS/8Yws/k/Jrn/KHGCp3SQYtWlhhS2W78lOehBmKySLxfPGFI5XN7oN9yaPmFF//2ruiqbr9lAUpa8VdlgQgy0ca82veWOTIi9WER0ojdndyFJn0nyZuDqNoWDwWRxVzQU/YMtVIIFhw3R0CFVVXkEq/Tgic3Vvg+lUj5oZGCRJa0Lg1odm+tl/cqmyjWu8gIXUC6ugxFUHsiwKVEgtuVQwgYLb7/bMZoVSvXSRhciokE+ng/8x/olp749M3/OwN3VBkrjIuYFiRvxi1/gfuz8yeT6ArA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS4-0001ib-Au; Mon, 12 May 2025 22:33:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 6/9] system: Migrate sourcing bash_completion.sh to etc-bashrc-d-service-type. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, gabriel@erlikon.ch, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:04 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035626488 (code B ref 78308); Tue, 13 May 2025 02:33:04 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:42 +0000 Received: from localhost ([127.0.0.1]:56328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRh-0001gZ-Vk for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:42 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:47414) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRb-0001fS-KO for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:36 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7423fb98cb1so3285702b3a.3 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103549; x=1747708349; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K1zgxA3JygQVWUgyv8FXtsicDjog+fJkdeoHSsxm4Fs=; b=kXNJdB5GuDP8lhNQ3jTXMw2zTYEJkOXamz80568bXPZsfcx93yHUdUtdjPZsIQow5t BtQ9/aZ+ePLKZFaFheOuLU7MnbgBq9QQ/knN0j1QXRc+7RLwvx/+HjIti2c4c77zV3dT g2yGPP7er1t9jPiyO/jXcr8XN7FoRokN534DxK9jb6W9YmftBpuoFVNEQj2MEi+ozzgB bZuZASBmu7ZaWVjx8taAH9i3jcEhdpMnK4/X4dvL1p5Zrqj1it2h33gdxsQCCN2ODfCr xbDezjSGAT50ONQhVOjaG7pAQXmqo3N1tSWMtD5badjmFRgK2gGngp/gkYgmfAh+EJEG 2+rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103549; x=1747708349; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K1zgxA3JygQVWUgyv8FXtsicDjog+fJkdeoHSsxm4Fs=; b=TzYbliZly/jJ6/T+yOWiSaRS+Zv1Xu2N10MtUexNtqI/tWUa7kkokyNLEVAah4g1vs RaaHlhhg5yx8f0tiWaZz8SudSXWY4mc9ZPDhFDTzii46gKvSGVrtOBekgrqcDPXmEJXl 6yVYDJ9JALUir+qahlEtMM93HPKXfAd2ipfNIcq/Qt2O2RS+98Bn9phePsk7aF3iS23Z 1pWaKWWqmIrlsTjYeo6KxGi++AD+NitUT/b/0i7jILqyaYYKzJWsLQRA9tOytAGw12au OC5KbrMjq613xvtmz4yVmGhGE5ouIykSL9saVlSRKVDcYEbUMPLpwBGOQ9mLxbr0IaKo 04ew== X-Gm-Message-State: AOJu0Yxuvo6gj9PLawcK7Xa6y00xN9Nfu8pTdVGBZ9JSRQX8DEsQj2FF T6j9VKxLYe4yGh/o0CVbBGGUutZ7MJG4H9yfOSWZA0H8BWpzbPpdUiC4qa6t X-Gm-Gg: ASbGncs6KlejRd8Ol8A1BKZ6BSXF/Jy4zdobfBUPrgKxMX2LpUCjWhuR7fkz2vg1kjs YbbOBK8+4HWcVkEtmYZVXHkjaGVPvvnhEUOoyeEUXzLr/MMhkZNvda3Y5l3VL70HBG9wuDiZTQA o2XfH5bVfFzLvoSFGFp5nMzbHobxRNhsLRGLeLeuiHPuGDxGrbReVwTye1KCEuCj5AD8n2A3f4I 5DAs+i09i+82icdPetp2xOlH8V2zaQkkzrfcwcf05eW/VXDHInxzWtSARSC0PGdxIAlB6k7GBKl Am3i4drZeYY33L5OJyOtlnNelqWL23DPbhIR3NIp2xzW0upl1NmW7Mz6az/1glHfsp/emRX4JJv saybqXA== X-Google-Smtp-Source: AGHT+IF1azktO6i2DFDWSp85eyLw2wVR9qW/xqNHLp6WWKz9Hfkhi5hzcNNXk8VTu8rJto7HvI+33Q== X-Received: by 2002:a05:6a21:348b:b0:1f5:7b6f:f8e8 with SMTP id adf61e73a8af0-215abb51860mr22693913637.6.1747103549104; Mon, 12 May 2025 19:32:29 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:28 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:45 +0900 Message-ID: <30d609e7beecdee13f99bbc2be247eaa02a72bcf.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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): Remove block sourcing bash_completion.sh. (%base-packages-interactive): Delete bash-completion. * gnu/services.scm (%default-etc-bashrc-d-files): New variable, which includes the bash_completion.sh file. (etc-bashrc-d-service-type): Use it. * doc/guix.texi (Service Reference): Update documentation. Change-Id: I2223a5f96f5d761148badc6be29e1c5c80465a1d --- doc/guix.texi | 11 +++++++---- gnu/services.scm | 8 +++++++- gnu/system.scm | 10 ---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 559896ff3a1..28ce18688e7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47578,15 +47578,18 @@ Service Reference file-like objects, as can be produced with @code{local-file}, @code{plain-file}, etc. Note that provided files whose file names do not end with @file{.sh} are @emph{not} added to @file{/etc/profile.d/} -and are silently dropped. Package objects can also be provided directly -to have their @file{etc/bashrc.d/*.sh} prefixed files added. An example -usage may look like: +and are silently dropped. The default value is made available via the +@var{%default-etc-bashrc-d-files} variable for users to extended. +Package objects can also be provided directly to have their +@file{etc/bashrc.d/*.sh} prefixed files added. An example usage may +look like: @example (use-package-modules gnome) ;for the `vte' package (service etc-bashrc-d-service-type - (list (file-append vte "/etc/profile.d/vte.sh"))) + (append (list (file-append vte "/etc/profile.d/vte.sh")) + %default-etc-bashrc-d-files)) @end example @end defvar diff --git a/gnu/services.scm b/gnu/services.scm index 7083c88c130..5dbda176b80 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -124,6 +124,7 @@ (define-module (gnu services) etc-service-type etc-profile-d-service-type etc-bashrc-d-service-type + %default-etc-bashrc-d-files etc-directory privileged-program-service-type setuid-program-service-type ; deprecated @@ -992,6 +993,10 @@ (define etc-profile-d-service-type (define files->bashrc-d-directory (make-files->etc-directory "bashrc.d")) +(define %default-etc-bashrc-d-files + (list (file-append bash-completion + "/etc/profile.d/bash_completion.sh"))) + (define etc-bashrc-d-service-type (service-type (inherit etc-profile-d-service-type) @@ -1000,7 +1005,8 @@ (define etc-bashrc-d-service-type files->bashrc-d-directory))) (description "A service for populating @file{/etc/bashrc.d/} with Bash scripts having the @file{.sh} file extension, to be sourced by interactive -Bash shells."))) +Bash shells.") + (default-value %default-etc-bashrc-d-files))) (define (privileged-program->activation-gexp programs) "Return an activation gexp for privileged-program from PROGRAMS." diff --git a/gnu/system.scm b/gnu/system.scm index 0b64927f5ba..50f739c17c7 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -960,7 +960,6 @@ (define %base-packages-interactive nvi man-db info-reader ;the standalone Info reader (no Perl) - bash-completion kbd ;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also ;; want the other commands and the man pages (notably because @@ -1146,15 +1145,6 @@ (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 - for i in /etc/bashrc.d/*.sh; do [[ -r $i ]] && source \"$i\" done From patchwork Tue May 13 02:31:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42564 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 A0EC227BC49; Tue, 13 May 2025 03:33:38 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 2F36427BC4D for ; Tue, 13 May 2025 03:33:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfSB-0004il-Gy; Mon, 12 May 2025 22:33:11 -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 1uEfS9-0004hr-3E for guix-patches@gnu.org; Mon, 12 May 2025 22:33:09 -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 1uEfS7-00085W-RP; Mon, 12 May 2025 22:33:07 -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=UTDWpJyyUOt3b/jDDYK2WtoZiOKFn6lvjIJd0edGsbc=; b=oJnRv8PO7mrtv6p7ilnPgLebshvnlINO5IxhZmGIRwkvTU/TgTPWcR+hvX5RrhGP69KP3gK6EaIo4r8tKieUuD2nJG/O8iQWYiEAuJnWetsnZHexNaxF9xhoeo8XmZ1Xzeh6l9q4P0ESEU8mmfh5FxxhgZwFJODijyEORg3Sp565wfkMdy/ALcOk5aaIe4LQ4lKhd/4wjYCzQ5OAnDwtI3hn2mTxhdtkbTUYjMcUHbmT8/ArfB0ZBAo89CNMEGVuKzcFBu48XsV+D7tcoGBr3o4lHsP4cdLOXLgRetvZL9mJnbe3wFSoDxGvZNTVAaUrp21qb1L1CU1o0cvxf1m/PQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS4-0001ik-Qg; Mon, 12 May 2025 22:33:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 7/9] system: Factorize bashrc default configuration. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, andrew@trop.in, gabriel@erlikon.ch, hako@ultrarare.space, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:04 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Andrew Tropin , Gabriel Wicki , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Andrew Tropin , Gabriel Wicki , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035666514 (code B ref 78308); Tue, 13 May 2025 02:33:04 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:46 +0000 Received: from localhost ([127.0.0.1]:56332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRl-0001gw-M4 for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:46 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:58700) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRf-0001ff-Bx for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:40 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-742596d8b95so2660892b3a.1 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103552; x=1747708352; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UTDWpJyyUOt3b/jDDYK2WtoZiOKFn6lvjIJd0edGsbc=; b=R199LNthuNvjQYzm4d2DuwbpenmrUyXYYs/6qLr8OFYcyrR5JY/a0iAx3/TVGZJXA6 0X3Lqzu/iQzaqN8V8kzgeTwtLc7ans64IurGaSsJRdF79hfJg3kNtCZ/UMhNAcALf1K8 NbryyKQ1BkgzuzDg9c/UVCS6qCSaYCDW+5UA5CspufSo14iRORyRehMc9S2xZNggwU0i fU13SQw++OeYA9KgwE5VPJ4Mk1y4YONXggi8evoiGv0l0H4P4sW2iwNfb/gKB+g2kcCy iuNiz4qo4eoVU7hYtlB6IlQVyMeRFbDyw4WOuSFdG+hupfc4PppacFLKrodkbydb459R KzGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103552; x=1747708352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UTDWpJyyUOt3b/jDDYK2WtoZiOKFn6lvjIJd0edGsbc=; b=MfpIypLUcam+A/x20oA6eyRHyNSfHj/Z6fb+qKHjKtsm3mJa8DHZlHkgg+PZzNe/OJ 192p7DykMowu0g3SOeBkWoCeRFMLZM0HiFOrut6noRhalMItbCECB8yBkcIfyNPxS3Jw 0mM5xRb5SJORmMw+3fPGAlmwdew+IXE2KhvzVdUEpBRbkWdjmu9v1CiYg141emSR0rM7 fQxvvUS1Vb1CnDImSf1Fcli6lnXuluvJKRc52y2JEVEfuDn6ikjiYGPPZbAGnbPLWRlj CSEqoBfPBOkg2/vYOxp+VHN+934HAfo365rDUwxAkKIXHBQznnx63OephIbfY5xIhpWg ECYw== X-Gm-Message-State: AOJu0Yw40WiYeU4dnXxMdCoTqkW9PMuixOE0lkkWaLXFuPgAeyi5+w9l 79pPPmTH+2659eqe6uI/rbpGPGE/6+9gZLdKwiq9yACbrwDiEXOlaOHC9VhX X-Gm-Gg: ASbGnctc9AtvL0wausgmWP6VMkJeMpd5KaBnboRSr6d13H7oeQjKuPtfPRYzZCX2ElL 7/JQtS6DLoxmXrBSDViSnIZK/SAqhteqDomLb5lvolfm42wSm3N/U/eVS8BGKifnHh912ldgBZY AnPp4WS9AG7cgqkPIcuosiZiJocyA8+7Z2JcduOLvGJQqkewiCqgD0MIEcBdXziwqFtqKCN4zcy zROUZg8efsh4ErGfOePJlRi+fUGy19SYV4al3l3AG63EIFUOLe6Y0LFO+cCi+UDu9LSdDsU1Vn1 b5c7Va9vCxeZT7GgSOD6bVejrhEFgzcZn74bffbFSLKC2nKKVx3yC0tJuVi0VvfN1sidvSg= X-Google-Smtp-Source: AGHT+IF4uGT9y1TvKja+6Gv7rovyKHueDoS60XvBP4MbnkeVB7atMSc5bBBqC4B/6eQ+JX+0fdzF3g== X-Received: by 2002:a05:6a00:1488:b0:730:95a6:3761 with SMTP id d2e1a72fcca58-7423ba87372mr24762943b3a.3.1747103551978; Mon, 12 May 2025 19:32:31 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:31 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:46 +0900 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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 This factorizes out the remaining bashrc bits from /etc/skel/.bashrc to a the template used for both /etc/bashrc on Guix System and ~/.bashrc for home-bash-service-type. Rationale: The use of /etc/skel introduce state: the file is only copied originally when the user account is created, and never (automatically) refreshed again. * gnu/system.scm (operating-system-etc-service): : Guard against souring /etc/bashrc in non-interactive, SSH case. : Use %default-bashrc, having migrated the remaining definitions to... * gnu/system/shadow.scm (%default-bashrc): ... here. Factorize aliases to... * gnu/services.scm (%default-bash-aliases): ... here. (%default-bashrc-d-aliases): New variable. (%default-etc-bashrc-d-files): Include it in the default configuration. * gnu/services/base.scm (%base-services): Register etc-bashrc-d-service-type. * gnu/home/services/shells.scm (add-bash-configuration): Do not set PS1, now part of %default-bashrc. (home-bash-configuration) [guix-defaults?]: Update doc. [aliases]: Set %default-bash-aliases as the default value. Update doc. * doc/guix.texi (Shells Home Services): Update documentation. (Service Reference): Update example. Change-Id: I340c614983a78fd20a9c4a9705e7fc542ae9b513 --- doc/guix.texi | 19 +++++++++++-------- gnu/home/services/shells.scm | 14 +++++++------- gnu/services.scm | 23 +++++++++++++++++++++-- gnu/services/base.scm | 5 ++++- gnu/system.scm | 24 +++++++----------------- gnu/system/shadow.scm | 18 ++++++++++-------- gnu/tests/base.scm | 17 ++++++++++------- 7 files changed, 70 insertions(+), 50 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 28ce18688e7..655eac6168d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47581,15 +47581,15 @@ Service Reference and are silently dropped. The default value is made available via the @var{%default-etc-bashrc-d-files} variable for users to extended. Package objects can also be provided directly to have their -@file{etc/bashrc.d/*.sh} prefixed files added. An example usage may -look like: +@file{etc/bashrc.d/*.sh} prefixed files added. Since the service is +part @code{%base-services}, it can be extended via @code{simple-service} +like so: @example (use-package-modules gnome) ;for the `vte' package -(service etc-bashrc-d-service-type - (append (list (file-append vte "/etc/profile.d/vte.sh")) - %default-etc-bashrc-d-files)) +(simple-service 'vte-integration etc-bashrc-d-service-type + (list (file-append vte "/etc/profile.d/vte.sh"))) @end example @end defvar @@ -49215,8 +49215,11 @@ Shells Home Services The Bash package to use. @item @code{guix-defaults?} (default: @code{#t}) (type: boolean) -Add sane defaults like reading @file{/etc/bashrc} and coloring the output of -@command{ls} to the top of the @file{.bashrc} file. +Add sane defaults like setting @env{PS1}, @env{SHELL}, and ensuring +@file{/etc/profile} is sourced for non-interactive SSH shells. If you +use Guix System, is it safe to set this to @code{#f}, as in this case +this is already taken care of by the globally installed +@file{/etc/bashrc}. @item @code{environment-variables} (default: @code{'()}) (type: alist) Association list of environment variables to set for the Bash session. The @@ -49224,7 +49227,7 @@ Shells Home Services here (@pxref{Essential Home Services}). The contents of this field will be added after the contents of the @code{bash-profile} field. -@item @code{aliases} (default: @code{'()}) (type: alist) +@item @code{aliases} (default: @code{%default-bash-aliases}) (type: alist) Association list of aliases to set for the Bash session. The aliases will be defined after the contents of the @code{bashrc} field has been put in the @file{.bashrc} file. The alias will automatically be quoted, diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index bab5730c3d6..969a3eb8dcf 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -20,6 +20,7 @@ (define-module (gnu home services shells) #:use-module (gnu services configuration) + #:use-module ((gnu services) #:select (%default-bash-aliases)) #:autoload (gnu system shadow) (%default-bashrc %default-zprofile) #:use-module (gnu home services utils) #:use-module (gnu home services) @@ -333,9 +334,12 @@ (define-configuration home-bash-configuration (package bash) "The Bash package to use.") (guix-defaults? + ;; TODO: Set to #f when the target system is determined to be Guix System. (boolean #t) - "Add sane defaults like reading @file{/etc/bashrc} and coloring the output of -@command{ls} to the top of the @file{.bashrc} file.") + "Add sane defaults like setting @env{PS1}, @env{SHELL}, and ensuring +@file{/etc/profile} is sourced for non-interactive SSH shells. If you use +Guix System, is it safe to set this to @code{#f}, as in this case this is +already taken care of by the globally installed @file{/etc/bashrc}.") (environment-variables (alist '()) "Association list of environment variables to set for the Bash session. The @@ -344,7 +348,7 @@ (define-configuration home-bash-configuration added after the contents of the @code{bash-profile} field." (serializer serialize-posix-env-vars)) (aliases - (alist '()) + (alist %default-bash-aliases) "Association list of aliases to set for the Bash session. The aliases will be defined after the contents of the @code{bashrc} field has been put in the @file{.bashrc} file. The alias will automatically be quoted, so something line @@ -423,10 +427,6 @@ (define (add-bash-configuration config) 'bashrc (if (home-bash-configuration-guix-defaults? config) (list (plain-file-content %default-bashrc) "\n" - ;; The host distro might provide a bad 'PS1' - ;; default--e.g., not taking $GUIX_ENVIRONMENT into - ;; account. Provide a good default here when asked. - "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '\n" (serialize-field 'aliases)) (list (serialize-field 'aliases)))) (file-if-not-empty 'bash-logout))))) diff --git a/gnu/services.scm b/gnu/services.scm index 5dbda176b80..159d357c3e7 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -125,6 +125,7 @@ (define-module (gnu services) etc-profile-d-service-type etc-bashrc-d-service-type %default-etc-bashrc-d-files + %default-bash-aliases etc-directory privileged-program-service-type setuid-program-service-type ; deprecated @@ -993,9 +994,27 @@ (define etc-profile-d-service-type (define files->bashrc-d-directory (make-files->etc-directory "bashrc.d")) +;;; Use an alist to be compatible with . +(define %default-bash-aliases + '(("ls" . "ls -p --color=auto") + ("ll" . "ls -l") + ("grep" . "grep --color=auto") + ("ip" . "ip -color=auto"))) + +;;; ... but avoid the full blown bash-serialize-aliases, which depends on +;;; other 'guix home' definitions such as `shell-double-quote'. +(define %default-bashrc-d-aliases + (plain-file "aliases.sh" + (string-join + (map (match-lambda + ((alias . value) + (format #f "~a=~s~%" alias value))) + %default-bash-aliases) + ""))) + (define %default-etc-bashrc-d-files - (list (file-append bash-completion - "/etc/profile.d/bash_completion.sh"))) + (list (file-append bash-completion "/etc/profile.d/bash_completion.sh") + %default-bashrc-d-aliases)) (define etc-bashrc-d-service-type (service-type diff --git a/gnu/services/base.scm b/gnu/services/base.scm index dfb96b1f0cc..adf456dc99e 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -4135,7 +4135,10 @@ (define %base-services (service mingetty-service-type (mingetty-configuration (tty "tty5"))) (service mingetty-service-type (mingetty-configuration - (tty "tty6"))) + (tty "tty6"))) + + ;; Extra Bash configuration including Bash completion and aliases. + (service etc-bashrc-d-service-type) (service static-networking-service-type (list %loopback-static-networking)) diff --git a/gnu/system.scm b/gnu/system.scm index 50f739c17c7..0b251bd3a08 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1132,23 +1132,13 @@ (define* (operating-system-etc-service os) done unset i -if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ] -then - # Load Bash-specific initialization code. - . /etc/bashrc +if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]; then + # Load Bash-specific initialization code, taking care to not source + # /etc/bashrc when invoked from a non-interactive SSH shell, + # to avoid recursion (/etc/bashrc also sources /etc/profile + # in the non-login, non-interactive SSH case). + [[ $- != *i* && -n $SSH_CLIENT ]] || source /etc/bashrc fi -")) - - (bashrc (plain-file "bashrc" "\ -# Bash-specific initialization. - -# Provide a default prompt. The user's ~/.bashrc can override it. -PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' - -for i in /etc/bashrc.d/*.sh; do - [[ -r $i ]] && source \"$i\" -done -unset i "))) (service etc-service-type `(("os-release" ,os-release) @@ -1159,7 +1149,7 @@ (define* (operating-system-etc-service os) ("issue" ,issue) ,@(if nsswitch `(("nsswitch.conf" ,nsswitch)) '()) ("profile" ,profile) - ("bashrc" ,bashrc) + ("bashrc" ,%default-bashrc) ;; Write the operating-system-host-name to /etc/hostname to prevent ;; NetworkManager from changing the system's hostname when connecting ;; to certain networks. Some discussion at diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 50ac102707e..03af193f36f 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -146,8 +146,11 @@ (define %base-user-accounts (define %default-bashrc (plain-file "bashrc" "\ -# Bash initialization for interactive non-login shells and -# for remote shells (info \"(bash) Bash Startup Files\"). +# Bash-specific initialization, including for non-login and remote +# shells (info \"(bash) Bash Startup Files\"). + +# Provide a default prompt. +PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' # Export 'SHELL' to child processes. Programs such as 'screen' # honor it and otherwise use /bin/sh. @@ -164,10 +167,11 @@ (define %default-bashrc return fi -alias ls='ls -p --color=auto' -alias ll='ls -l' -alias grep='grep --color=auto' -alias ip='ip -color=auto'\n")) +for i in /etc/bashrc.d/*.sh; do + [[ -r $i ]] && source \"$i\" +done +unset i +")) (define %default-bash-profile (plain-file "bash_profile" "\ @@ -288,12 +292,10 @@ (define (default-skeletons) 'useradd' in the home directory of newly created user accounts." (let ((profile %default-bash-profile) - (bashrc %default-bashrc) (zprofile %default-zprofile) (xdefaults %default-xdefaults) (gdbinit %default-gdbinit)) `((".bash_profile" ,profile) - (".bashrc" ,bashrc) ;; Zsh sources ~/.zprofile before ~/.zshrc, and it sources ~/.zlogin ;; after ~/.zshrc. To avoid interfering with any customizations a user ;; may have made in their ~/.zshrc, put this in .zprofile, not .zlogin. diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index edb7e9112ba..85e5b954b90 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -187,6 +187,8 @@ (define* (run-basic-test os command #:optional (name "basic") "\ . /etc/bashrc set -e -x +test -f /etc/bashrc.d/bash_completion.sh +test -f /etc/bashrc.d/aliases.sh test -f /etc/bashrc.d/test_bashrc_d.sh test \"$BASHRC_D_OK\" = yes")) marionette))) @@ -593,14 +595,15 @@ (define* (test-basic-os #:optional (kernel linux-libre)) (plain-file "invalid-name" "not a POSIX script -- ignore me"))) - (service + (simple-service + 'extra-bashrc-d-files etc-bashrc-d-service-type - (list (plain-file - "test_bashrc_d.sh" - "export BASHRC_D_OK=yes\n") - (plain-file - "invalid-name" - "not a Bash script -- ignore me"))) + (list (plain-file + "test_bashrc_d.sh" + "export BASHRC_D_OK=yes\n") + (plain-file + "invalid-name" + "not a Bash script -- ignore me"))) %base-services))) #:imported-modules '((gnu services herd) (guix combinators)))) From patchwork Tue May 13 02:31:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42563 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 2009927BC4A; Tue, 13 May 2025 03:33:37 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 B1AF427BC49 for ; Tue, 13 May 2025 03:33:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfS9-0004i1-5s; Mon, 12 May 2025 22:33:09 -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 1uEfS6-0004h7-Td for guix-patches@gnu.org; Mon, 12 May 2025 22:33:07 -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 1uEfS6-000857-Jg; Mon, 12 May 2025 22:33:06 -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=dfTsUSoT6HyssPfKpHTdpFPLK2IFk7JhpFbmEnrAPMY=; b=fiwTPbUZ5PB9ul4lFCyCIyLFlKjXI+9qRpqDqkA8x/d2IHXAzpaB2OBkiXhAdkWmDm7UPG86Ye5piAHQ7nntADkHnTo0QCxAgWnPWKyEIgIuJnzMykqzHZ/AwFk9GpfM/I7G+Og4PmJX6qHe90lYWx2DorfS2FF+AIwuZuxHcckBU8+ZVmJ+iZYe73h5N/OQIhrixQtrWpeMeignEJ5AQA/kVnPCYbsjc7yB4tDUVwVcTOaQA1MnW4aNr98piLFB6ZoZQFVGHcPLl3QXCJ0siAu/uh0aZKmRk9gW+28a7zRu9yTXZV11HIsaliFMP/R9e8b/1FpNK1K4vEDiB99uSQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS5-0001it-8J; Mon, 12 May 2025 22:33:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 8/9] services: Add vte-integration-service-type. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, gabriel@erlikon.ch, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:05 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035676521 (code B ref 78308); Tue, 13 May 2025 02:33:05 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:47 +0000 Received: from localhost ([127.0.0.1]:56334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRm-0001h1-Ks for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:47 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:44129) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRi-0001g7-Ip for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:43 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7423fb98c5aso2911775b3a.0 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103555; x=1747708355; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dfTsUSoT6HyssPfKpHTdpFPLK2IFk7JhpFbmEnrAPMY=; b=lmcG7KFLeXxjUlQp5m7iMW7ctwlxOLdr+BAgRQ5YCw4YgdY932PPE0jF+N9JqpbqU9 QELO1ghkfiIgtd/elP4PTzNYnGVjoQvinJIpbRqI4JZY9svIr5HHCJ2P69/WU3T33M83 iJsdOp5hMKb2b8UTFQd0JFDte+xSXgkMbiscGBNCP07rZXs/egYax/StBpneMHvOgNFg 4a9Yoiu/i4AjNQfjbJ0devCjLjHyLzwX8mJCLq6JIifUiTXg3F3EPVMoXM4AKfoRIBdy O53QzaATaxfdoJTbCrHbgx4fIZOkVZhWzSws/h/AvqlBxyIvUKy0F+G9rXd2hROwYbEg JHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103555; x=1747708355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dfTsUSoT6HyssPfKpHTdpFPLK2IFk7JhpFbmEnrAPMY=; b=FbSey/VcPWAvM6UPPKkTBUa4Lm2SnAL8sCUO0z62hn9ziF2OKrTAd3j+Kt9hnJ3f5c n7/UjuKGam6M1GcsC81w8nKF6Y8YnWAnIO6fMjVpHNXcOyPtGvcnly4/PrrZN6gztxkZ XgdQzicKOmy94dYfP/c7HwkZpnNPSCV3QbEld/aNSs8DByz7UDuX7ILaRhvQY7JhuUdU EKwz3HFnlRXz3Jbc+NBKpAdKElU3moyUXSz1yUyW73zw/EE+ttlPHqbTBOeYIpO944xU MKT5Q1JKbeXm2L5QDJLhOz/RcjOggZ1pvruUxA35hwKOj8N08KbVXgzUUbG06iCi08tl A/VA== X-Gm-Message-State: AOJu0YzT3ZrqHOTGvKi4UnIiwK36neTppT9iaI6m8XHDHTY6Y56DRjTM WduFk1BJLDaXmPTtTA6rwSchiArNW0z1jCelYXUwzL9KZ9hXuuCDWQr+WRc/ X-Gm-Gg: ASbGncvYtU8jVMKtI0sXSQniicHPwnoQpwLgfTnerGWFqxo63pIfYlOBV14/NKFfJwM 5l4csqJxPWQ9YB0itoH3s0IU1bonE01pRhdS4bE7gYv4YhbWnw/WcW0fJrDhkZ/fSxwW/bdNo02 q+NN7OP5WCHFdSSnAURuP4enkaNNSDqWJcoNeqP/gG4mR/ntbj9yOLK2rmCnl0kK0axxNs3BQ0Y JP2vJSSB1ns0+86z/M9vwsq40IPz2eY18EHp9KUvXUlYCbbVVZLEsr8E073rbfZt3DfBo6mMUS0 w66rOzwfcRz8tcowpuX391slNyIPZ+5RlI8xO4v4UUCMNVS/gw8dS7LncUItHKBr6TWiPC8= X-Google-Smtp-Source: AGHT+IGez7ua1MjOYI6n7znYlTDOic7u+AeJwmL4eybBDdyUWTMQXNY6/oPSkwKQqV4Um4OxPg+Ebw== X-Received: by 2002:a05:6a00:450a:b0:740:41e4:e761 with SMTP id d2e1a72fcca58-7423c07be27mr19831759b3a.22.1747103554886; Mon, 12 May 2025 19:32:34 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:34 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:47 +0900 Message-ID: <40912ff35c97c933961c9d71e66369b8db9d94fe.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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/services.scm (vte-integration-service-type): New service type. * doc/guix.texi (Service Reference): Document it. Change-Id: I7e4bc1b913b50a5a061894f9ddef27f1877b62a2 --- doc/guix.texi | 15 +++++++++++++++ gnu/services.scm | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 655eac6168d..591d42f82f5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47593,6 +47593,21 @@ Service Reference @end example @end defvar +@defvar vte-integration-service-type +This services adds the @file{/etc/bashrc.d/vte.sh} to your system, which +improves the Bash and Zsh experience when using VTE-powered terminal +emulators. This causes for example the current directory to be +displayed in the terminal emulator's tab title, and the current +directory to be preserved when creating a new tab, among other features. +The value of the service is the @code{vte} package to use. + +@example +(use-package-modules gnome) ;for the `vte' package + +(service vte-integration-service-type vte) +@end example +@end defvar + @defvar privileged-program-service-type Type for the ``privileged-program service''. This service collects lists of executable file names, passed as gexps, and adds them to the set of diff --git a/gnu/services.scm b/gnu/services.scm index 159d357c3e7..ce15a39d063 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -47,6 +47,7 @@ (define-module (gnu services) #:use-module (guix deprecation) #:use-module (gnu packages base) #:use-module (gnu packages bash) + #:use-module (gnu packages gnome) #:use-module (gnu packages hurd) #:use-module (gnu packages linux) #:use-module (gnu system privilege) @@ -138,6 +139,7 @@ (define-module (gnu services) linux-builder-configuration-kernel linux-builder-configuration-modules linux-loadable-module-service-type + vte-integration-service-type %boot-service %activation-service @@ -1027,6 +1029,19 @@ (define etc-bashrc-d-service-type Bash shells.") (default-value %default-etc-bashrc-d-files))) +(define vte-integration-service-type + (service-type + (name 'vte-integration) + (extensions + (list (service-extension etc-bashrc-d-service-type + (lambda (vte) + (list (file-append + vte "/etc/profile.d/vte.sh")))))) + (default-value vte) ;the vte package to use + (description "A service for adding the @file{/etc/bashrc.d/vte.sh} script +to your system, which improves the Bash and Zsh experience when using +VTE-powered terminal emulators."))) + (define (privileged-program->activation-gexp programs) "Return an activation gexp for privileged-program from PROGRAMS." (let ((programs From patchwork Tue May 13 02:31:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42561 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 781DF27BC4E; Tue, 13 May 2025 03:33:35 +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.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,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 0C50027BC49 for ; Tue, 13 May 2025 03:33:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEfSA-0004iP-1z; Mon, 12 May 2025 22:33:10 -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 1uEfS6-0004h8-UH for guix-patches@gnu.org; Mon, 12 May 2025 22:33:07 -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 1uEfS6-000859-Kp for guix-patches@gnu.org; Mon, 12 May 2025 22:33:06 -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=MoAMoaEusKroBnrdKiR5DNzke0YokH2E1H9vDfTJa6c=; b=TV9o3prCSqPkPuAPSfJeUZfga49g3k8F1wilAf4POTeBwR3CwnEjliDYA4ujAju9ah6yDPi/yf2blLiBu5vioqcDgVb+u5J1AbFJSJUKKMQ1Ie6ZqqecqUJR2ExUBNfw7YQsiGYWdabPAJETAOWpKjYKYDGG7MtY+S6cr/L2lMrorbXPJFwEcil9z0W2Sd1FF5VPulags4jHA3/jGLtVKu7BwdtqekBLziZV31+9olk0vgGofed3KmdxopO6iKgPAWJawQkS4Ce1t+BSe+ESjP8CZim+5B+BPhY8bY2EUXb+ZMOSibK2wcqx/m1PO2GIwTfgvB+LLi4zuDGyQ2leyw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEfS5-0001j2-Np; Mon, 12 May 2025 22:33:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78308] [PATCH v2 9/9] services: Add vte-integration-service-type to %desktop-services. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, rutherther@ditigal.xyz, liliana.prikler@gmail.com, noelopez@free.fr, vivien@planete-kraus.eu, guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 02:33:05 +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: 78308@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Rutherther , Liliana Marie Prikler , =?utf-8?q?No=C3=A9?= Lopez , Vivien Kraus X-Debbugs-Original-Xcc: Maxim Cournoyer , Rutherther , Liliana Marie Prikler , =?utf-8?q?No=C3=A9?= Lopez , Vivien Kraus Received: via spool by 78308-submit@debbugs.gnu.org id=B78308.17471035716533 (code B ref 78308); Tue, 13 May 2025 02:33:05 +0000 Received: (at 78308) by debbugs.gnu.org; 13 May 2025 02:32:51 +0000 Received: from localhost ([127.0.0.1]:56336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEfRr-0001hI-4w for submit@debbugs.gnu.org; Mon, 12 May 2025 22:32:51 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:56552) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEfRk-0001gN-Cz for 78308@debbugs.gnu.org; Mon, 12 May 2025 22:32:44 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7425bd5a83aso1828454b3a.0 for <78308@debbugs.gnu.org>; Mon, 12 May 2025 19:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747103558; x=1747708358; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MoAMoaEusKroBnrdKiR5DNzke0YokH2E1H9vDfTJa6c=; b=Oxrw+VkfoUiL2OYshKvRArMg6gpqCUB7VsqOh65hFIKlCH4nBppebO8Aug1l0f5Hye l981qTVf/a+cuk8PBcobWqbqHknswcgXcDy71O5TfmPKvvZbdGm7uYF0lw/QhnRCko9J s68vT8OpHid2NA25GKmYuuvtqZwuryLbu1Lj6axSkGfhK67QHcinrcGMjyKVljyBViRX wsB7IlAHE5+dCtFZEempbcZjo8NPgT0DFqPEqw9d2vwNpUaVmnQPAva3b9nwEauolM+2 dP9gguDVvUjkVn2P4Oth1XeH1atz9mIpkDugQZorNzZdRZ5DIu/L4nKobhvyZ+XEyNfR FaKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747103558; x=1747708358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MoAMoaEusKroBnrdKiR5DNzke0YokH2E1H9vDfTJa6c=; b=bLpk9J1rYAAdMt3FiRzWyJaW9vfX9zjpaJdFO47U8Ir6K0EWownwpVlV10FLROtDy6 TYkkcqqGnRjopdgODWWlJ7zMsZEmJsFM1eDvsXcJeBZJVVoDp5Hh40iF4d5fpzktr1v+ XypYh8wHNVTUcPMDK5gr3wO48Ctx0B1/9NCGxs7QsjQvV4yFPhB6bdKY5tCZSxCPQHHr BOE/YEu0HP92FDIdxu+N5Rs3cv9lDx8CNtg5SS6Qzz4wW87wVEBOH9ZYK5cqTSBOiseG Rs0bJRwDxCtCgYhv+k1LJt+VF9q+WvoiHQn72CZmpfXgo/wI7PCNuSxu0fYXHdpc8fpP Se0w== X-Gm-Message-State: AOJu0YyY7yw65usQ2qOmda0O4g+yKfvZkyfXSaVMngVhyRphQANlm0/f wMaE+Fhx/ubrymDhBf3yh2lQ4n1gE6tNwmhX3+YXIVPV5W166TXKWTA/4NPT X-Gm-Gg: ASbGncukoYOifzGL9OWLIZIqhmppSe36LPrCRo48juXjoPPp8yTC7LGEnp0CDFVfMZA cFIt6HT9eSTI2FaecSDN5DVwgh4Wi3+pzJ2O8YG29moq4aR0iZsui3VLM6RMkcPWgYxQ9vR4Uy0 UsZ75bHjybOhAJLd9DrjCvABgUW4Adar5DSq47UWLPd9tLPGXmP0u/hih6BYypwrHNWZK5/Ja58 55MUGvOZY9c3qUvXcSi8aukP+Rz6L0kQlWFu9YRq/XYhqSeG9snnsshkjhPP60NYJqdnNibaVsQ q64mBnyepg65S2qCgaYiGvNlW2eC8pqb1NKySdTIWLK2XjBsjBBOLRAVOrVMGP7HV65yURs= X-Google-Smtp-Source: AGHT+IEhdAM+VuAr8lpZ/KANU/7NvRkPYWkvRRPNC0SSLc7iixU5IMKZmoNwb0nRAaZBwJuSGXLNXg== X-Received: by 2002:a05:6a21:3296:b0:1f6:6539:e026 with SMTP id adf61e73a8af0-215abb04384mr22733614637.15.1747103557693; Mon, 12 May 2025 19:32:37 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a387a6sm6947460b3a.137.2025.05.12.19.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 19:32:37 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 May 2025 11:31:48 +0900 Message-ID: <97a0168581a8849007a14d488f446347d3c5fb41.1747103508.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> References: <5cf9f21c9626bb8c8357089caa747c2ae8ae2fca.1747103508.git.maxim.cournoyer@gmail.com> 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/services/desktop.scm (desktop-services-for-system): Fixes: Change-Id: Ib29468468e327801a4e95361610159de61f7e8d6 --- gnu/services/desktop.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 12560a6249d..38ff2187356 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -2463,6 +2463,10 @@ (define* (desktop-services-for-system #:optional ;; to avoid GDM stale cache and permission issues. gdm-file-system-service + ;; Provides a nicer experience for VTE-using terminal emulators such + ;; as GNOME Console, Xfce Terminal, etc. + (service vte-integration-service-type) + ;; The global fontconfig cache directory can sometimes contain ;; stale entries, possibly referencing fonts that have been GC'd, ;; so mount it read-only.