From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GFFYKkdzuF5jbQAA0tVLHw (envelope-from ) for ; Sun, 10 May 2020 21:33:59 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qMdfF1VzuF4jEgAAB5/wlQ (envelope-from ) for ; Sun, 10 May 2020 21:34:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B18BF94050B for ; Sun, 10 May 2020 21:34:10 +0000 (UTC) Received: from localhost ([::1]:55050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXtaN-0007r4-IO for larch@yhetil.org; Sun, 10 May 2020 17:34:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXtaE-0007qe-7a for bug-guix@gnu.org; Sun, 10 May 2020 17:34:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXtaD-0008GF-Ue for bug-guix@gnu.org; Sun, 10 May 2020 17:34:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jXtaD-0003yk-Qq for bug-guix@gnu.org; Sun, 10 May 2020 17:34:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41140: =?UTF-8?Q?=E2=80=9Cguix_?= =?UTF-8?Q?system=E2=80=9D?= suggests wrong module import when using =?UTF-8?Q?=E2=80=9Cremove=E2=80=9D?= Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 10 May 2020 21:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41140 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 41140@debbugs.gnu.org Received: via spool by 41140-submit@debbugs.gnu.org id=B41140.158914640015233 (code B ref 41140); Sun, 10 May 2020 21:34:01 +0000 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 X-Spam-Score: 2.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=elephly.net header.s=zoho header.b=IvUVjUG2; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Scan-Result: default: False [2.09 / 13.00]; GENERIC_REPUTATION(0.00)[-0.53921177038126]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.08), country: US(-0.00), ip: 209.51.188.17(-0.54)]; TO_DN_NONE(0.00)[]; R_DKIM_REJECT(1.00)[elephly.net:s=zoho]; ARC_REJECT(2.00)[signature check failed: fail, {[1] = sig:zohomail.com:reject}]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; DKIM_TRACE(0.00)[elephly.net:-]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[79.213.161.24:received]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; MIME_UNKNOWN(0.10)[text/x-patch]; FROM_NEQ_ENVFROM(0.00)[rekado@elephly.net,bug-guix-bounces@gnu.org]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[elephly.net:email,gnu.org:email]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[elephly.net]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[209.51.188.17:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: eJLaUkvqAiVR --=-=-= 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 --=-=-=--