all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Add a way to disable serialization support to (guix services configuration)
@ 2021-04-12 20:57 Maxim Cournoyer
  2021-04-17 16:29 ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Maxim Cournoyer @ 2021-04-12 20:57 UTC (permalink / raw)
  To: guix-devel

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-08  5:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-12 20:57 Add a way to disable serialization support to (guix services configuration) Maxim Cournoyer
2021-04-17 16:29 ` 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

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.