From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +NYqEI0TZGKgMQAAbAwnHQ (envelope-from ) for ; Sat, 23 Apr 2022 16:56:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ePEwEI0TZGLVAQAA9RJhRA (envelope-from ) for ; Sat, 23 Apr 2022 16:56:13 +0200 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 E9D51B905 for ; Sat, 23 Apr 2022 16:56:12 +0200 (CEST) Received: from localhost ([::1]:60736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niHBE-0002SP-5u for larch@yhetil.org; Sat, 23 Apr 2022 10:56:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niHB4-0002Rz-Ds for guix-patches@gnu.org; Sat, 23 Apr 2022 10:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1niHB4-0006sO-4m for guix-patches@gnu.org; Sat, 23 Apr 2022 10:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1niHB4-0005aF-3s for guix-patches@gnu.org; Sat, 23 Apr 2022 10:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54674] [PATCH v4 1/2] services: configuration: Support (field1 maybe-number "") format. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 Apr 2022 14:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54674 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Attila Lendvai , 54674@debbugs.gnu.org Received: via spool by 54674-submit@debbugs.gnu.org id=B54674.165072573621424 (code B ref 54674); Sat, 23 Apr 2022 14:56:02 +0000 Received: (at 54674) by debbugs.gnu.org; 23 Apr 2022 14:55:36 +0000 Received: from localhost ([127.0.0.1]:56976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1niHAd-0005ZT-Q5 for submit@debbugs.gnu.org; Sat, 23 Apr 2022 10:55:36 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:58048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1niHAb-0005ZK-Cf for 54674@debbugs.gnu.org; Sat, 23 Apr 2022 10:55:33 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by albert.telenet-ops.be with bizsmtp id NEvX270074UW6Th06EvX7M; Sat, 23 Apr 2022 16:55:31 +0200 Message-ID: <813b73d348bd7de3e19573f5e4261da2120711c0.camel@telenet.be> From: Maxime Devos Date: Sat, 23 Apr 2022 16:55:31 +0200 In-Reply-To: <20220420091553.26732-1-attila@lendvai.name> References: <20220401191957.16624-1-attila@lendvai.name> <20220420091553.26732-1-attila@lendvai.name> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-ebzziRVvDO+3/c42eNdo" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1650725732; bh=avU+veIlGlXxdsKwvOGIVOgo2/qRkvDvq/5xbFEacdI=; h=Subject:From:To:Date:In-Reply-To:References; b=TNI0bP4hrAZwnCa+yBjspfQp3SqCRexRlqpLEVVO64ClUhdDvj5gkHB6nHj4S1Kxo 1eaiyY9yZmuJhYym/7X/ixgRXxusJgCrvXZbUHRZMi1KFD4fiaVR5C0MuL95WsJEES i3wLn56yLxSVAqHgf9UT98U0efA0Ek9dJVqV6Gd1Nr1aHx4I0HCTLINzXd11Bgh7fz 1dEzn8QlAW5XaIRkBYpd9tBuWQ0kP6Q2gRYTVMktIehpG3MR0O8iSZ6OXDiKInI3Bm sTSvfHioB0IMNS5uR/FTdsjgXDxBhY3YjIjBxVIQugvrEYrhJOo1lqRUdYk1RPx0Rz EgR6Hs9dGa5Ng== 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650725773; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=avU+veIlGlXxdsKwvOGIVOgo2/qRkvDvq/5xbFEacdI=; b=NUErFFrO+P7KxNje+tB/7Uj/yfihwSdNvrGoDqQcuHFzZ4rJMSBdQTPSBV+sYtjU/VKafa rkQHxMyeMPq6XzK8KGL/7pnlQHm3HtklTVAvVkyfE4DrlP/jDkzduicZznRw+sQI1TMxH2 A6QesxBFW8fzdyX/ByajjpU8hOi6vzFJlgJpSxDz8EsckA09EMA/1LRXozyZ5ujehWOFh5 IpJjBl+dEPWNHr5UAeC/GfOh0bte7EKQcnRCk+Gm2FmHdPI5DGFnN580qFU+wMK4ZrM5CZ U7JR7oy+GI3YD6MSGHZfajILptaTCGNT8KqK/wH6kqHM1t3zZ+0WRghq441ZOw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650725773; a=rsa-sha256; cv=none; b=MObfXsRPJTmA4Vm2/LLnm+hDnNoNdkJdJZ+BNAST0x2oTP2c4C09UFUtiyqw3jU2f5v6HA Hm7O4BdjzF/X4skyA2J+He/F95kn1EyP/KIIMNfqViq6O/Td7XqbS/7XlAdUcPyyQrZ2DB XcCJu0zfk1jeH9PdmzX4T8L0IK42AH1cp9606+zV8paDFqctDi6gXQk2sAgxYs9MLtk34o wVw4P8IxbuihOM1fnac8GR0j6gXn/ALbn5Y2pj8bCjBG5kgUwFaeEtJdRZECdiiO3ct6EF yOnF56hbiD7IZp9ZaHgHJgiqiEpTx5OJkDcSklWDMXSxvCycvYjaHnQ58d7c5w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=TNI0bP4h; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.88 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=TNI0bP4h; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E9D51B905 X-Spam-Score: 3.88 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1w8IJ+vMrbvn --=-ebzziRVvDO+3/c42eNdo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I didn't look into the code in detail, but for this kind of thing, if it compiles, it probably works. For completeness, you might want to run a few system tests (=E2=80=98make check-system=E2=80=99 IIRC). However, ... Attila Lendvai schreef op wo 20-04-2022 om 11:15 [+0200]: > As opposed to explicitly using 'disabled as value, or using the > (field1 (maybe-number) "") format. >=20 > It's mostly the work of Maxime Devos shared under #54674, with some > modifications by Attila Lendvai. >=20 > * gnu/services/configuration.scm (normalize-field-type+def): New function= . > (define-configuration-helper) (define-configuration): Support new field > format. > * tests/services/configuration.scm (config-with-maybe-number->string): Ne= w > function. > ("maybe value serialization of the instance"): New test. > ("maybe value serialization of the instance, unspecified"): New test. ... 'define-configuration' and 'disabled' is documented in the manual (guix)Complex Configurations: When defining a =E2=80=9Cmaybe type=E2=80=9D, the corresponding serial= izer for the regular type will be used by default. For example, a field of type =E2=80=98maybe-string=E2=80=99 will be serialized using the =E2=80=98serialize-string=E2=80=99 procedure by default, you can of co= urse change this by specifying a custom serializer procedure. Likewise, the type of the value would have to be a string, unless it is set to the =E2=80=98disabled=E2=80=99 symbol. It also appears in other locations in the documentation: =E2=80=98daytime-brightness=E2=80=99 (default: =E2=80=98disabled=E2=80= =99) (type: maybe-inexact-number) Daytime screen brightness, between 0.1 and 1.0. The available configuration parameters follow. Each parameter definition is preceded by its type; for example, =E2=80=98string-list foo= =E2=80=99 indicates that the =E2=80=98foo=E2=80=99 parameter should be specified as a= list of strings. Types starting with =E2=80=98maybe-=E2=80=99 denote parameters th= at won=E2=80=99t show up in =E2=80=98prosody.cfg.lua=E2=80=99 when their value is =E2=80=98'disab= led=E2=80=99. [...] So the documentation appears to be needed to be changed as well. Greetings, Maxime. --=-ebzziRVvDO+3/c42eNdo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYmQTYxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7mIUAQDFuL+3LYJEbYvQSkmLu4z1kwjz LsD+us5fzeWQk2Hu0QD/aGbHFKHxpWBiCsqmNi7Wwz5rOTdMiyiqZAVT2VrW2gQ= =Pbj/ -----END PGP SIGNATURE----- --=-ebzziRVvDO+3/c42eNdo--