From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0AaiJ/EclmDMeAEAgWs5BA (envelope-from ) for ; Sat, 08 May 2021 07:09:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0K02I/EclmCMbQAAbx9fmQ (envelope-from ) for ; Sat, 08 May 2021 05:09:05 +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 B332E287E2 for ; Sat, 8 May 2021 07:09:04 +0200 (CEST) Received: from localhost ([::1]:44514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfFD5-0000nh-7l for larch@yhetil.org; Sat, 08 May 2021 01:09:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfFCw-0000nY-QM for guix-devel@gnu.org; Sat, 08 May 2021 01:08:54 -0400 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:41804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfFCu-0001kl-W3; Sat, 08 May 2021 01:08:54 -0400 Received: by mail-qt1-x831.google.com with SMTP id t20so3938965qtx.8; Fri, 07 May 2021 22:08:51 -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=zFYLZ4ftZqLckhdSBnRX+lIkxgNuI87utyOztYw3eKg=; b=N5eGyrGmexbomY6zHkDPGkTAm9yczNbpiDlBpgrciKd6svZptsCPFBGtVTEZ5fyBbZ ZBxFelVWxFrcZvr4KKHKNIvWfyq94eQdIYHeGQgCoue34zZHG/WYfwA0WLNQX2ptV/ma l4cKXEG6IzDk8l/zpJaBCJbQnh2tk+bY9WkQpjUn/FrIoqOnHNF941Xr+hQrmKEhCAZh HG6995BmFdHUI5FGL2MRhA6hfuHE4VF9Wrobf4Wj0BJk6Hv7EVMG0oBQ54ETrqUGE438 1rVlBpuj0cGq9oPjqYv0G56+X6Gn+z+weVqppMV8e2DuRihX074LSpORnRJxfRDJp0ey eW5w== 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=zFYLZ4ftZqLckhdSBnRX+lIkxgNuI87utyOztYw3eKg=; b=e60jGC+4G1HLQwFGaQPyABwHHZRI33MuGPb0ROJ5H70YyvH5y9Foc7qDG0VSL7It2X jzWzyQj5RxkvLPaRGGUyNgGQnrsFK/650rTGuUbn3Xo44YOAVv2COlUp8Y43pLIUR4uD ZFcao+Q9GM7v7/mJTCoBEbE+dSTY9hj2lAdo1xebw8UYzuIeEw0POuiOTiA3OMSiOhNw ErLAvXHOHZJ6TUa0q9lNQEbVnS8LNIxXc2gvw4MqXLutdhbK8nCaqNXDGbDPTZc2y9uH RZO5gjj85xbPWF5rPCgGpvC+bYwOSYRXxagRq1eM64xOWKCeC2RKhKTzw6nTUKlPQan9 8wkw== X-Gm-Message-State: AOAM53313Y5YHMtn5K9zoe+5WLIst7ZPoj/iDKBQLol0DzXvzHitSsbW Q07cbneq7jqNplC/0MW3Wind1AQtfsQ= X-Google-Smtp-Source: ABdhPJzxTNzcpbXCTSbEBMFxP7XkeRwDW8ZLyeFwKTCGKxVu1rHLk5wWsTkdCtEApx9gaTxBedNlpw== X-Received: by 2002:ac8:4049:: with SMTP id j9mr12840424qtl.79.1620450531088; Fri, 07 May 2021 22:08:51 -0700 (PDT) Received: from hurd (dsl-10-130-94.b2b2c.ca. [72.10.130.94]) by smtp.gmail.com with ESMTPSA id g5sm7715411qtm.2.2021.05.07.22.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 22:08:50 -0700 (PDT) From: Maxim Cournoyer To: Xinglu Chen Subject: Re: Add a way to disable serialization support to (guix services configuration) References: <878s5ncjaw.fsf@gmail.com> <87fszoswmc.fsf@gnu.org> <87k0ovd4ok.fsf@gmail.com> <87mttqt0ms.fsf@gnu.org> <871rb15y6k.fsf@yoctocell.xyz> <87k0oik6sy.fsf@yoctocell.xyz> Date: Sat, 08 May 2021 01:08:49 -0400 In-Reply-To: <87k0oik6sy.fsf@yoctocell.xyz> (Xinglu Chen's message of "Sat, 01 May 2021 13:54:53 +0200") Message-ID: <87czu1x15q.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::831; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x831.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=1620450545; 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=zFYLZ4ftZqLckhdSBnRX+lIkxgNuI87utyOztYw3eKg=; b=YM5newfAFDptJD4fB0PXqT9kkP3avIwJfplU+tuDTsZ5dkpMyCBAQI0GjjtjQ5XPuFP000 16yq1xhoGmGs0vWQT83FCEicae1PJ5HyjnSJKf2UJ6JUe8IQEEEFCHjO4YfLe+MdziXap2 tIpuQfTqRMpJF/7a4i0HmqGlzVkEHuQZKYenP2CDN08pW2EUnmwavQ3+Zk/gwaiqTB9x/4 kXxC4oNR2v53uEQmjJHQiWYloBydSAofRb9w56LQJRbjIT3nILZk14cn0C1Zg+IkyyNSeQ afJILx54PhNBHTgcIGMDqBN2rUZb7hxz6vCVOnjNsuN1+oWpawQcACgXAuTnCw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620450545; a=rsa-sha256; cv=none; b=LIw+W6veEIAcotQMIGfmmYYZg8I1IMSPqgxb5IYKd/jJgWMCVP0imOtYypdsDK+Rer1582 CBCeYdAuQHyLTmRLLIllOVV2n8AGkN2UseIlt3Og5skpknCNX0blLFixXF3+FvdjI+Ln+9 cclkhJMF/Iha4Py5I+lIECxcklVVCUXrVJN5RkJRZW0z6DqQMxJo7RurYGWvBowfj2HHCH YaB6WUTcYpe4lp+5GhFMgzkEM7jKdFmLMkB2Ywfjtt+Ke0iIIOgnK1mq87MSrXMkv5tdUh 3Rp4VCjmuxPBS1RvSOVlax2GKRTyUm5RZ2E8kNzc7scXbJvaXAjpzDb8cx5EmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=N5eGyrGm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: -1.35 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=N5eGyrGm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: B332E287E2 X-Spam-Score: -1.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: VaC1xvVYsLLN Hi, Xinglu Chen writes: [...] > From 90d63a46a29a8080b7f95eabcec115c5c2c6481e Mon Sep 17 00:00:00 2001 > Message-Id: <90d63a46a29a8080b7f95eabcec115c5c2c6481e.1619869705.git.publ= ic@yoctocell.xyz> > In-Reply-To: > References: > From: Xinglu Chen > Date: Sat, 1 May 2021 13:31:27 +0200 > Subject: [PATCH 2/2] services: configuration: Add ability to use custom > serializer. > MIME-Version: 1.0 > Content-Type: text/plain; charset=3DUTF-8 > Content-Transfer-Encoding: 8bit > > Some configuration values should not be serialized to a configuration fil= e, > e.g. command line options for a daemon. > > * gnu/services/configuration.scm (define-configuration): Add option to us= e a > custom serializer. > (empty-serializer): New procedure. > (serialize-package): Alias to =E2=80=98empty-serializer=E2=80=99. > --- > gnu/services/configuration.scm | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.= scm > index 85e1ac78cb..7024b13136 100644 > --- a/gnu/services/configuration.scm > +++ b/gnu/services/configuration.scm > @@ -44,6 +44,7 @@ > define-configuration > validate-configuration > generate-documentation > + empty-serializer > serialize-package)) >=20=20 > ;;; Commentary: > @@ -116,7 +117,7 @@ > (define-syntax define-configuration > (lambda (stx) > (syntax-case stx () > - ((_ stem (field (field-type properties ...) doc) ...) > + ((_ stem (field (field-type properties ...) doc custom-serializer = ...) ...) > (with-syntax (((field-getter ...) > (map (lambda (field) > (id #'stem #'stem #'- field)) > @@ -133,9 +134,12 @@ > (_ (syntax 'disabled))) > #'((field-type properties ...) ...))) > ((field-serializer ...) > - (map (lambda (type) > - (id #'stem #'serialize- type)) > - #'(field-type ...)))) > + (map (lambda (type serializer) > + (match serializer > + (((serializer)) serializer) > + (_ (id #'stem #'serialize- type)))) > + #'(field-type ...) > + #'((custom-serializer ...) ...)))) > #`(begin > (define-record-type* #,(id #'stem #'< #'stem #'>) > #,(id #'stem #'% #'stem) > @@ -176,8 +180,8 @@ > #,(id #'stem #'stem #'-fields)) > conf)))))))) >=20=20 > -(define (serialize-package field-name val) > - "") > +(define (empty-serializer field-name val) "") > +(define serialize-package empty-serializer) >=20=20 > ;; A little helper to make it easier to document all those fields. > (define (generate-documentation documentation documentation-name) Rebased on a change that allows to globally (at the configuration level) disable serialization and pushed as b3e99d3399. Thank you! :-) Maxim