From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 01 17:03:06 2021 Received: (at submit) by debbugs.gnu.org; 1 Aug 2021 21:03:06 +0000 Received: from localhost ([127.0.0.1]:37024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAIby-0005iR-4Y for submit@debbugs.gnu.org; Sun, 01 Aug 2021 17:03:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:38750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAIbw-0005iK-FJ for submit@debbugs.gnu.org; Sun, 01 Aug 2021 17:03:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAIbv-0001vh-1B for guix-patches@gnu.org; Sun, 01 Aug 2021 17:03:04 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:46805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAIbs-00049O-Tk for guix-patches@gnu.org; Sun, 01 Aug 2021 17:03:02 -0400 Received: (Authenticated sender: brice@waegenei.re) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E261C20003 for ; Sun, 1 Aug 2021 21:02:57 +0000 (UTC) From: Brice Waegeneire To: guix-patches@gnu.org Subject: [PATCH] services: In MODIFY-SERVICES macro allow specifying a service by its name. Date: Sun, 1 Aug 2021 23:02:54 +0200 Message-Id: <20210801210254.6119-1-brice@waegenei.re> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=217.70.183.200; envelope-from=brice@waegenei.re; helo=relay7-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) This is specially useful with any services singleton created with 'simple-service' such as 'set-xorg-configuration'. * doc/guix.texi (Service Reference)[modify-services]: Document support for specifying service by its name. * gnu/services.scm (modify-services): Support specifying a service by its name in addition to its type. --- doc/guix.texi | 14 +++++++------- gnu/services.scm | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2298d512a1..3b50976358 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34319,20 +34319,20 @@ standard list combinators such as @code{map} and @code{fold} to do that common pattern. @deffn {Scheme Syntax} modify-services @var{services} @ - (@var{type} @var{variable} => @var{body}) @dots{} + (@var{type-or-name} @var{variable} => @var{body}) @dots{} Modify the services listed in @var{services} according to the given clauses. Each clause has the form: @example -(@var{type} @var{variable} => @var{body}) +(@var{type-or-name} @var{variable} => @var{body}) @end example -where @var{type} is a service type---e.g., -@code{guix-service-type}---and @var{variable} is an identifier that is -bound within the @var{body} to the service parameters---e.g., a -@code{guix-configuration} instance---of the original service of that -@var{type}. +where @var{type-or-name} is a service type or name---e.g., +@code{guix-service-type} or @code{'guix}---and @var{variable} is an +identifier that is bound within the @var{body} to the service +parameters---e.g., a @code{guix-configuration} instance---of the +original service of that type. The @var{body} should evaluate to the new service parameters, which will be used to configure the new service. This new service will replace the diff --git a/gnu/services.scm b/gnu/services.scm index 2a8114a219..736ad2e4b9 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -303,8 +303,9 @@ singleton service type NAME, of which the returned service is an instance." (%modify-service svc clauses ...))) ((_ service) service) - ((_ svc (kind param => exp ...) clauses ...) - (if (eq? (service-kind svc) kind) + ((_ svc (kind-or-name param => exp ...) clauses ...) + (if (or (eq? (service-kind svc) kind-or-name) ;kind + (eq? (service-type-name (service-kind svc)) kind-or-name)) ;name (let ((param (service-value svc))) (service (service-kind svc) (begin exp ...))) -- 2.32.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 10:24:08 2021 Received: (at 49812) by debbugs.gnu.org; 10 Aug 2021 14:24:08 +0000 Received: from localhost ([127.0.0.1]:60194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSfl-0001yx-4Q for submit@debbugs.gnu.org; Tue, 10 Aug 2021 10:24:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSfg-0001yQ-Ki for 49812@debbugs.gnu.org; Tue, 10 Aug 2021 10:24:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50998) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDSfa-0003Qr-J3; Tue, 10 Aug 2021 10:23:54 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=45062 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDSfa-0001eZ-AJ; Tue, 10 Aug 2021 10:23:54 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Brice Waegeneire Subject: Re: bug#49812: [PATCH] services: In MODIFY-SERVICES macro allow specifying a service by its name. References: <20210801210254.6119-1-brice@waegenei.re> Date: Tue, 10 Aug 2021 16:23:51 +0200 In-Reply-To: <20210801210254.6119-1-brice@waegenei.re> (Brice Waegeneire's message of "Sun, 1 Aug 2021 23:02:54 +0200") Message-ID: <87o8a5qsy0.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49812 Cc: 49812@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Brice Waegeneire skribis: > This is specially useful with any services singleton created with > 'simple-service' such as 'set-xorg-configuration'. Could you show an example? Services created by =E2=80=98simple-service=E2= =80=99 & co. are effectively anonymous; it=E2=80=99s a bit like a lambda. > * doc/guix.texi (Service Reference)[modify-services]: Document support > for specifying service by its name. > * gnu/services.scm (modify-services): Support specifying a service by > its name in addition to its type. [...] > +++ b/gnu/services.scm > @@ -303,8 +303,9 @@ singleton service type NAME, of which the returned se= rvice is an instance." > (%modify-service svc clauses ...))) > ((_ service) > service) > - ((_ svc (kind param =3D> exp ...) clauses ...) > - (if (eq? (service-kind svc) kind) > + ((_ svc (kind-or-name param =3D> exp ...) clauses ...) > + (if (or (eq? (service-kind svc) kind-or-name) = ;kind > + (eq? (service-type-name (service-kind svc)) kind-or-name)) = ;name As a general design pattern in Guix, =E2=80=9Cnames=E2=80=9D (symbols) are = here for UI and/or debugging purposes; they should not be used elsewhere because, by definition, names are ambiguous. Conversely, object references are unambiguous and non-forgeable, so I prefer interfaces that avoid =E2=80=9Cn= ames=E2=80=9D entirely. I hope that makes sense! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 02 10:20:55 2023 Received: (at control) by debbugs.gnu.org; 2 Jun 2023 14:20:55 +0000 Received: from localhost ([127.0.0.1]:40580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q55e9-0005RS-9W for submit@debbugs.gnu.org; Fri, 02 Jun 2023 10:20:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q55e4-0005R9-Qm for control@debbugs.gnu.org; Fri, 02 Jun 2023 10:20:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q55dz-00013G-KM for control@debbugs.gnu.org; Fri, 02 Jun 2023 10:20:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=pOirrRz7iy7MWxh+mCJtXC99g6LkX5BOw9hfw0rou6I=; b=heJxc5GVatDVjE R6jd5l5a4C2Df3BAsbLhZ3/Ew4/f4ahvR8CKStWDaD+C/n2TYHqqbP0oWeCVvXr7cXVOsTKppyIoD /bYirZq8U6qjV3aHr58+7bMvCNIdQsvLQhGSPDXIduBsz/gWE1/a1uv6y2SgE00umdYUSu+j/FLt3 jPvjiZhuUwEEwMe3spCPojnI9w8VmC0htbHZ0b4JAW/6AydpExnVbGKkO++kR8vGaqQRDES0NR80A JdtgOy6SWjOO2UoDkEurGQfFbzEPhYC/sI3+SmUo0QsZSqCNX+lHljW4VEaCR25GzwnjlplMUXurG W70G9R8K6nBECzBxGM6w==; Received: from [193.50.110.155] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q55dz-0002SC-7D for control@debbugs.gnu.org; Fri, 02 Jun 2023 10:20:43 -0400 Date: Fri, 02 Jun 2023 16:20:41 +0200 Message-Id: <871qiu54jq.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #49812 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 49812 wontfix close 49812 quit From unknown Sat Jun 14 03:54:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 01 Jul 2023 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator