From debbugs-submit-bounces@debbugs.gnu.org Sun May 10 17:33:20 2020 Received: (at 41140) by debbugs.gnu.org; 10 May 2020 21:33:20 +0000 Received: from localhost ([127.0.0.1]:50636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtZY-0003xd-Ap for submit@debbugs.gnu.org; Sun, 10 May 2020 17:33:20 -0400 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtZX-0003xT-1I for 41140@debbugs.gnu.org; Sun, 10 May 2020 17:33:19 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1589146397; cv=none; d=zohomail.com; s=zohoarc; b=XDUBaWLIjyyrcbL/OGxUN1+Fk46JGqR3NJR/yxTb1UEhAIPzwO+Ay/nPOXaOtiAQ/cdhuFHMX+lV6q8JNmFlxxzIuAG/hLSovP6dfDCk+SvvgLCBuJlge2bQ4Q6sLM0MFoKWpkSY6ZXxVdks/+WQnYcNT/5r4R3R51TrQhyDl9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589146397; h=Content-Type:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=P5JxEadNQYmEcxysc0hdDywuV6B0wvNj528MPE4W1Pg=; b=BcfDHZV/1g2eBODxBtDUWJoYHIAHmZeUYgucd09gU34/lhkxgX0B+uPz1spvmoCxJ7nvb9gIZcfVoQKTmr2SexJRCx/OG97PFjlAraI+eI1FF1AffqUgVgiEAEzjhAvKUESsi6lnIJtlLfWkwE6fdPRpgsNRoONDXvKgR3POFlU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1589146397; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type; bh=P5JxEadNQYmEcxysc0hdDywuV6B0wvNj528MPE4W1Pg=; b=IvUVjUG29X6/GJmi7u+NEBO5tnIFS5jhOUOvjhIdp8ifUM07IPgJjia6Da5fCeGL CXnRJE1m99hVRk4Drir94Oa+hnElqj/Lvghw9cttzFvr6Zh/cfjfJLeVAFx0oKwAD47 OINcD4uFhaPzmOhBEVLWxFzeagzibI+H3Rht01fQ= Received: from localhost (p4FD5A118.dip0.t-ipconnect.de [79.213.161.24]) by mx.zohomail.com with SMTPS id 1589146395885613.4655770232221; Sun, 10 May 2020 14:33:15 -0700 (PDT) References: <87lfm22il6.fsf@elephly.net> User-agent: mu4e 1.2.0; emacs 26.3 From: Ricardo Wurmus To: 41140@debbugs.gnu.org Subject: Re: =?utf-8?Q?=E2=80=9Cguix_system=E2=80=9D?= suggests wrong module import when using =?utf-8?B?4oCccmVtb3Zl4oCd?= In-reply-to: <87lfm22il6.fsf@elephly.net> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Sun, 10 May 2020 23:33:11 +0200 Message-ID: <877dxj327c.fsf@elephly.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-ZohoMailClient: External X-Zoho-Virus-Status: 1 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41140 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: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ricardo Wurmus writes: > * can we avoid this by extending modify-services to support =E2=80=9Cdele= te=E2=80=9D > much like modify-phases, and suggesting to use that instead of > =E2=80=9Cremove=E2=80=9D? The attached patch does this. What do you think? --=20 Ricardo --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-services-Support-DELETE-in-MODIFY-SERVICES-macro.patch Content-Transfer-Encoding: quoted-printable From 40c1208cbe9cbfa58ee385ef6ee06b775d309753 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 10 May 2020 23:29:38 +0200 Subject: [PATCH] services: Support DELETE in MODIFY-SERVICES macro. * gnu/services.scm (%modify-service): Add clause for DELETE syntax. (modify-services): Use FILTER-MAP; adjust docstring. * doc/guix.texi (System Services): Mention alternative syntax. (X Window): Use MODIFY-SERVICES syntax. --- doc/guix.texi | 13 ++++++++++--- gnu/services.scm | 23 +++++++++++++++-------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 14a42e7070..25274a8539 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11230,6 +11230,14 @@ following expression returns a list that contains = all the services in %desktop-services) @end lisp =20 +Alternatively, the @code{modify-services} macro can be used: + +@lisp +(modify-services %desktop-services + (delete avahi-service-type)) +@end lisp + + @unnumberedsubsec Instantiating the System =20 Assuming the @code{operating-system} declaration @@ -14732,9 +14740,8 @@ and tty8. (service slim-service-type (slim-configuration (display ":1") (vt "vt8"))) - (remove (lambda (service) - (eq? (service-kind service) gdm-service-type)) - %desktop-services)))) + (modify-services %desktop-services + (delete gdm-service-type))))) @end lisp =20 @end defvr diff --git a/gnu/services.scm b/gnu/services.scm index 2e4648bf78..ac614a7317 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Court=C3= =A8s ;;; Copyright =C2=A9 2016 Chris Marusich +;;; Copyright =C2=A9 2020 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,7 +34,7 @@ #:use-module (guix modules) #:use-module (gnu packages base) #:use-module (gnu packages bash) - #:use-module (srfi srfi-1) + #:use-module ((srfi srfi-1) #:hide (delete)) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-26) @@ -272,7 +273,11 @@ singleton service type NAME, of which the returned ser= vice is an instance." (service type value))) =20 (define-syntax %modify-service - (syntax-rules (=3D>) + (syntax-rules (=3D> delete) + ((_ svc (delete kind) clauses ...) + (if (eq? (service-kind svc) kind) + #f + (%modify-service svc clauses ...))) ((_ service) service) ((_ svc (kind param =3D> exp ...) clauses ...) @@ -302,16 +307,18 @@ TYPE. Consider this example: (mingetty-service-type config =3D> (mingetty-configuration (inherit config) - (motd (plain-file \"motd\" \"Hi there!\"))))) + (motd (plain-file \"motd\" \"Hi there!\")))) + (delete udev-service-type)) =20 It changes the configuration of the GUIX-SERVICE-TYPE instance, and that of -all the MINGETTY-SERVICE-TYPE instances. +all the MINGETTY-SERVICE-TYPE instances, and it deletes instances of the +UDEV-SERVICE-TYPE. =20 -This is a shorthand for (map (lambda (svc) ...) %base-services)." +This is a shorthand for (filter-map (lambda (svc) ...) %base-services)." ((_ services clauses ...) - (map (lambda (service) - (%modify-service service clauses ...)) - services)))) + (filter-map (lambda (service) + (%modify-service service clauses ...)) + services)))) =20 ;;; --=20 2.25.1 --=-=-=--