From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QM8MB1hIgGDFcwAAgWs5BA (envelope-from ) for ; Wed, 21 Apr 2021 17:44:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id OHeoAlhIgGDjDgAAbx9fmQ (envelope-from ) for ; Wed, 21 Apr 2021 15:44:24 +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 96FE719961 for ; Wed, 21 Apr 2021 17:44:23 +0200 (CEST) Received: from localhost ([::1]:35856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZF1a-0000Zo-Nu for larch@yhetil.org; Wed, 21 Apr 2021 11:44:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZF0T-0008IP-9I for guix-devel@gnu.org; Wed, 21 Apr 2021 11:43:13 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:34727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZF0Q-0006Vj-GU; Wed, 21 Apr 2021 11:43:12 -0400 Received: by mail-qt1-x82d.google.com with SMTP id c6so31562488qtc.1; Wed, 21 Apr 2021 08:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Waa7HpisB9fUOPN9hxuCjglj3TYj8P6dTKp3kl63Eik=; b=nuryY6e/dX2kXakTNwJDBNmydhRgN8DAqjFnpKjpEebagL4QKO0+ciWAJZgq6SYL0d RNuSNjzuwR04KbRr4su9c0RsLN+kP+neJp08FdludyJBIXYGmFWS8gFiMlbWHWZDyEzj jTS5w18vDWseMDRa2L6qp6zC0eYyFlTUQvlpX7F+fgLBFKkwGFjk0Yb3VWJW+3FMaOxC HjqeBdvAMdFpc1TUhivuNtwgy8JctuIk5Qjc1JYHKkuCDq9TbTUWC4F/EFcnr+tmoSXK 7s1vrlSfd8wpmL1sMfe3tkTyqxBP5FyoLq6T/qgiyrkAd7JgenQ/J+br7N7jiktaZZyG ChAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Waa7HpisB9fUOPN9hxuCjglj3TYj8P6dTKp3kl63Eik=; b=XrRypYmN89uQp+/NTFXg63Nm4qdr4YiloxG4hDK31BOWVXX1dlbsXBiz08wTycLklq ewqHNKQUZndfJa/DnZBltSic6KCaPB/TQrz3Qe7GCVGZ1i0n+0gTCQE0o+yzX6LWKE// DdR4gQaS0ZFpuFyfSUlrl/iIIoXUCbVDwBkaS3mqzPwVg01YddoI6Bfacb/bdsQB5nCe zlo92rAhOOeqeSIDdgOTQw4prLLv4ef/tbeSEQT/2MrHzw003C6W1bucVz40qvTRL8rk 4GAetmwVRfIB8t5D/T7I4WuL+O3TM47Dv1vw4A/CFdLa9LTj93FG8xAVmwJzoKg7tdW8 91ew== X-Gm-Message-State: AOAM531PjgArMjksYWb4ronXJ8aHNbTJWqYXDWYPukruBRx9DFk1O3xm MU4nXHnyetkHfCZl6W/EcFmgJTrvyMkwzw== X-Google-Smtp-Source: ABdhPJzVNTNPjTw98ddbZCI3tDHqR3AzQv1frPm9nM3xgpmgkNV/d7/nVl1fNyERJKSIvLKhxrr03Q== X-Received: by 2002:ac8:548f:: with SMTP id h15mr22176070qtq.29.1619019789065; Wed, 21 Apr 2021 08:43:09 -0700 (PDT) Received: from hurd (dsl-10-133-199.b2b2c.ca. [72.10.133.199]) by smtp.gmail.com with ESMTPSA id h65sm2382613qkd.112.2021.04.21.08.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 08:43:08 -0700 (PDT) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Add a way to disable serialization support to (guix services configuration) References: <878s5ncjaw.fsf@gmail.com> <87fszoswmc.fsf@gnu.org> Date: Wed, 21 Apr 2021 11:43:07 -0400 In-Reply-To: <87fszoswmc.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sat, 17 Apr 2021 18:29:15 +0200") Message-ID: <87k0ovd4ok.fsf@gmail.com> 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 Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619019863; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Waa7HpisB9fUOPN9hxuCjglj3TYj8P6dTKp3kl63Eik=; b=Kls7936zyULd7VGnYm1BY4owaI7f1psgFctKdW78XFLbgUNxBGDdpe/JsRDgq9wTaF54l4 0G5GqoeD7G530xQIzsTC9j6f6W56ALeTk7B37KMykfTpluTh8VJxuWa6S63+Lpugc2/k3g nqm0N2A342OD2GknHlAfbz3LDZK+YupINZc086/fhHpnw6GEVWn41ZIk3tu9e+BlBNYck5 z+fMPeqXakk2MHIA5mH3G9EX/HE/2gky5OulyWpbOhwBiK7sAD09/wvMWfkHdotodO1nND H0qxzAMHxeNm+1oMHBhIQP6/b/C2M8xtHS9k5VCRY9F99h6tvsyGBSVYcAQbyA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619019863; a=rsa-sha256; cv=none; b=PeRDwwojPA3vBsc5zNZyyDICwUKmgPVKOtGNy6Xfg+qQILdqDyXfNza9XknoOH/PQ4VtEy OZx/8LpZ1XthyYH1wWEv9mcTZo+XHbF4zvQGeqFFKAiQ3lV0ft4/I8AFXensoDECS6xFjE A0uUe0AjHtwD7DQ+rL/qpMm1pHjH/KEFLvGh+aHESmBExgGtfmFd82Fyjwd84owJYpm/SA MtXDAdTQ6w2dD2xp2uGJ4h9s9QAtQUIjt4x6L2jcxPMDYC0bRqc5X14rpyGw/op3hZQj+z kea8qBLsqkU2oHaBVhiP69eonS1skbAXoMoWW7M/IkXCCdkKFrbR+1X/Jg+sYw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="nuryY6e/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="nuryY6e/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 96FE719961 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: 7gThcofpM5Et Hi Ludovic, Ludovic Court=C3=A8s writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >> I've rediscovered the little gem that is (guix services configurations), >> and attempted to make it more generally useful by adding an option to >> opt out of serialization (which is not well adapted for producing a list >> of command line arguments from the configuration for example): > > In the meantime I saw you discuss this on #guile so maybe you=E2=80=99ve = solved > the issue now? No, thank you for your reply! :-) > If not, attached is a possible solution and example. It=E2=80=99s not pe= rfect: > in the example, you=E2=80=99ll get a warning about =E2=80=98serialize-int= eger=E2=80=99 being > unbound, which is completely harmless but suboptimal. Not sure how to > address that. > > diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.= scm > index 90f12a8d39..20e1647335 100644 > --- a/gnu/services/configuration.scm > +++ b/gnu/services/configuration.scm > @@ -109,6 +109,9 @@ > (define (serialize-maybe-stem field-name val) > (if (stem? val) (serialize-stem field-name val) "")))))))) > > +(define-syntax-parameter configuration-field-serialization? > + (identifier-syntax #t)) > + > (define-syntax define-configuration > (lambda (stx) > (syntax-case stx () > @@ -123,7 +126,8 @@ > #'(field-type ...))) > ((field-serializer ...) > (map (lambda (type) > - (id #'stem #'serialize- type)) > + #`(and configuration-field-serialization? > + #,(id #'stem #'serialize- type))) I tried: (if (syntax->datum configuration-field-serialization?) #,(id #'stem #'serialize- type) #false) hoping to get rid of the warning, but that appears to be strictly equivalent, resulting in the same warning. I also don't know how to fix that. > #'(field-type ...)))) > #`(begin > (define-record-type* #,(id #'stem #'< #'stem #'>) > @@ -152,6 +156,16 @@ > #,(id #'stem #'stem #'-fields= )) > conf)))))))) > > +(define-syntax-rule (without-field-serialization definition) > + (syntax-parameterize ((configuration-field-serialization? > + (identifier-syntax #f))) > + definition > + #t)) > + > +(without-field-serialization > + (define-configuration foo > + (bar (integer 123) "doc"))) > + > (define (serialize-package field-name val) > "") That does work, thanks! I'm a bit uncomfortable adding more warnings to the Guix build output; OTOH it provides value (another user recently pointed to the same annoyance here [0]). Maxim [0] https://lists.gnu.org/archive/html/guix-devel/2021-04/msg00319.html