all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: guix-devel <guix-devel@gnu.org>
Subject: Add a way to disable serialization support to (guix services configuration)
Date: Mon, 12 Apr 2021 16:57:43 -0400	[thread overview]
Message-ID: <878s5ncjaw.fsf@gmail.com> (raw)

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


             reply	other threads:[~2021-04-12 20:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 20:57 Maxim Cournoyer [this message]
2021-04-17 16:29 ` Add a way to disable serialization support to (guix services configuration) Ludovic Courtès
2021-04-21 15:43   ` Maxim Cournoyer
2021-04-22 22:28     ` Ludovic Courtès
2021-04-23  6:09       ` Xinglu Chen
2021-05-01 11:54         ` Xinglu Chen
2021-05-07  5:42           ` Maxim Cournoyer
2021-05-07 14:03             ` Xinglu Chen
2021-05-08  5:08           ` Maxim Cournoyer
2021-04-21 17:14   ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s5ncjaw.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.