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 gF1/JW20dGC3ZQAAgWs5BA (envelope-from ) for ; Mon, 12 Apr 2021 22:58:21 +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 GOpCH220dGAbJwAAbx9fmQ (envelope-from ) for ; Mon, 12 Apr 2021 20:58:21 +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 3FA2325A06 for ; Mon, 12 Apr 2021 22:58:21 +0200 (CEST) Received: from localhost ([::1]:47618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lW3dU-0004Ui-EM for larch@yhetil.org; Mon, 12 Apr 2021 16:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lW3d6-0004Tv-0y for guix-devel@gnu.org; Mon, 12 Apr 2021 16:57:57 -0400 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]:45606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lW3cx-0004UA-H5 for guix-devel@gnu.org; Mon, 12 Apr 2021 16:57:55 -0400 Received: by mail-qt1-x82b.google.com with SMTP id u8so11055687qtq.12 for ; Mon, 12 Apr 2021 13:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=/dToJAa6D63/KCp0r6FEGevF6MJvRghpk0Sj4wyGRfg=; b=nfjHZXsz3PWcdge1xav8/H2IKgxu6VY2jq4XJ/neKj4zYtpfRDwRmm7slcZhQ2sic6 X0wnAxVgC89/yCVO3FeOgYy6cTPXAK63QwtUrQkHenj921LY5MZHam19+ke9y9xIJsi/ v+QIDAdPEC/g93E5bm8kZwBXsZFKbflqhtKanAbewvshc98AZkvyU5rtKVjwJxMKBZOH lORUdEVgZ66ke18GJpj3oI1GSZ1fLaH6VqWKbfd+uYatRdgDgobWdRcFxFPjPljZL3oF 9t0u20W/j1Wd1ACvG8mHEvYCryXow088tbXUaPHwvi0xQJnJjEdQy7ZKiqxkQFKjx0nb RoVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=/dToJAa6D63/KCp0r6FEGevF6MJvRghpk0Sj4wyGRfg=; b=Wsrnq/hLm9iagXC7PiQfYL0adLhxsK56t/MbTVboNmudOLhnliYw8zxALSsUGgtNzj uGn5I7ARnlDmxlSIUqn2q/KADcL2U7Bi///5cPl6SDGkqPbmqVTIYMWzbwYj4+X2CRVA Z6QX1m25d5nPznRsUvV0xvWv/cXvabaxtAPSZ4JxvozH+YcLCUbtiFJCcu3npan/CxIk Pi+Fe3eabd0+5Yv8/hNfk4hvlkO/lF2+/OfUXKj1PR3c11wj5o5cX8TIQxamsr0ST3Fa GksujkRYBT2cne5vCsXzxfK85eVVpE1qcincxogiYuA+ETRkliEO3wJoRa4dWJ2wcDqS LE0g== X-Gm-Message-State: AOAM532AnGZTgQLQSTlm1OZQkUG4r+WqBaYdKDiE+NbaJGAtnFH2iRqn 7It12/hW+sGIY1pKhbtUofRxtXVBB2g= X-Google-Smtp-Source: ABdhPJxKXMpSSHzJQYLF9uOV7Kcd4XVsdLxVVM4oHbpKWBc7yx0RCuAUpIBaMAvpZqE1iUjcHcXFRw== X-Received: by 2002:ac8:57d0:: with SMTP id w16mr6585754qta.190.1618261065734; Mon, 12 Apr 2021 13:57:45 -0700 (PDT) Received: from hurd (dsl-10-128-209.b2b2c.ca. [72.10.128.209]) by smtp.gmail.com with ESMTPSA id l16sm3998788qtr.65.2021.04.12.13.57.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 13:57:44 -0700 (PDT) From: Maxim Cournoyer To: guix-devel Subject: Add a way to disable serialization support to (guix services configuration) Date: Mon, 12 Apr 2021 16:57:43 -0400 Message-ID: <878s5ncjaw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::82b; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82b.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: , 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=1618261101; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/dToJAa6D63/KCp0r6FEGevF6MJvRghpk0Sj4wyGRfg=; b=roneImy0ooyxVwp9rbUAK37sgII6ewuBGGukzOLAkw0KmtVv0UgLvYmh8YIH2JvUgjZVqJ AfDKzur/FrwS+9T4GM1FuC+zFSjuDBqWOr60UHczO8MdtFp6kyELTF22gAi5IDFY9i4rPP ABsjN0ytotj4kXdoLCUtnOSTFEwxTdD9fBmSv3ijEZbbK7huiOeayFC/m77lF6gteSfF/h JsjD0ImTjvzbNoPPQ6Z3Wvd/N7uIZ9h0XIz81zncPiZhEd31PjFf+Ec6D+8av2ohy+th8A 2rQ8/9upbegRvN3Gm83qQ2I0Xlovr3L37mRWrZi3WXkTQrD4l86bzh7v32gYCQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618261101; a=rsa-sha256; cv=none; b=OlV9LUB278iepUj1hxuhAIm0OWKEYcD2Uqvlx9ZO5SgnLFl5DdsJPX9KEo0Z+ID2oTNctK VqW4FG0vXC+ZqbW5/85LLkdl1YZ8E4+n+AgZOD6lKWpO6CfZl/gcSYy5/GcrQHEoBMV9fk WvbYJybGTI/RvF0TfrmXqB9TZ8ogJ999GxlPltN2IzLbr0tFexRlgZBJlhr5kI1s0W3r2x lTMPKVm033GvooKHzOOUphZgciv/ykQ3ei4caJMVuVoLWPmwoSGBk0BxF8mJxqx9VsDDi6 Jvfh3z4GxblzD3JN0zAJwUhUaERixmQUk+T6+mvX23ZVd34d6EyJZCGtm+fhsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=nfjHZXsz; 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=nfjHZXsz; 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: 3FA2325A06 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: k2d24A06PiGm Hello Guix! 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): --8<---------------cut here---------------start------------->8--- 1 file changed, 10 insertions(+), 1 deletion(-) gnu/services/configuration.scm | 11 ++++++++++- modified gnu/services/configuration.scm @@ -38,6 +38,9 @@ configuration-field-getter configuration-field-default-value-thunk configuration-field-documentation + + %with-serialization? + serialize-configuration define-maybe define-configuration @@ -51,6 +54,11 @@ ;;; ;;; Code: +;;; XXX: This doesn't actually work as a parameter with macros such as +;;; define-configuration; it is to be used as a plain global variable. +;;; Experiments with define-syntax-parameter did not work either. +(define %with-serialization? (make-parameter #true)) + (define-condition-type &configuration-error &error configuration-error?) @@ -123,7 +131,8 @@ #'(field-type ...))) ((field-serializer ...) (map (lambda (type) - (id #'stem #'serialize- type)) + (and (%with-serialization?) + (id #'stem #'serialize- type))) #'(field-type ...)))) #`(begin (define-record-type* #,(id #'stem #'< #'stem #'>) --8<---------------cut here---------------end--------------->8--- Unfortunately, it doesn't work, at least when using it from 'guix system'. I've also tried a version relying on syntax-parameter instead of a parameter, with the same result. Would someone know how it could be made to work? Thanks, Maxim