@@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration
(environment-variables
(alist '())
"Association list of environment variables to set for the Zsh session."
- serialize-posix-env-vars)
+ (serializer serialize-posix-env-vars))
(zshenv
(text-config '())
"List of file-like objects, which will be added to @file{.zshenv}.
@@ -334,7 +334,7 @@ (define-configuration home-bash-configuration
rules for the @code{home-environment-variables-service-type} apply
here (@pxref{Essential Home Services}). The contents of this field will be
added after the contents of the @code{bash-profile} field."
- serialize-posix-env-vars)
+ (serializer serialize-posix-env-vars))
(aliases
(alist '())
"Association list of aliases to set for the Bash session. The aliases will be
@@ -351,7 +351,7 @@ (define-configuration home-bash-configuration
@example
alias ls=\"ls -alF\"
@end example"
- bash-serialize-aliases)
+ (serializer bash-serialize-aliases))
(bash-profile
(text-config '())
"List of file-like objects, which will be added to @file{.bash_profile}.
@@ -536,19 +536,19 @@ (define-configuration home-fish-configuration
(environment-variables
(alist '())
"Association list of environment variables to set in Fish."
- serialize-fish-env-vars)
+ (serializer serialize-fish-env-vars))
(aliases
(alist '())
"Association list of aliases for Fish, both the key and the value
should be a string. An alias is just a simple function that wraps a
command, If you want something more akin to @dfn{aliases} in POSIX
shells, see the @code{abbreviations} field."
- serialize-fish-aliases)
+ (serializer serialize-fish-aliases))
(abbreviations
(alist '())
"Association list of abbreviations for Fish. These are words that,
when typed in the shell, will automatically expand to the full text."
- serialize-fish-abbreviations))
+ (serializer serialize-fish-abbreviations)))
(define (fish-files-service config)
`(("fish/config.fish"
@@ -372,7 +372,7 @@ (define-configuration mpd-configuration
(music-dir ; TODO: deprecated, remove later
maybe-string
"The directory to scan for music files."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(playlist-directory
maybe-string
@@ -381,7 +381,7 @@ (define-configuration mpd-configuration
(playlist-dir ; TODO: deprecated, remove later
maybe-string
"The directory to store playlists."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(db-file
maybe-string
@@ -407,16 +407,16 @@ (define-configuration mpd-configuration
port is used.
To use a Unix domain socket, an absolute path or a path starting with @code{~}
can be specified here."
- (lambda (_ endpoints)
- (if (maybe-value-set? endpoints)
- (mpd-serialize-list-of-string "bind_to_address" endpoints)
- "")))
+ (serializer (lambda (_ endpoints)
+ (if (maybe-value-set? endpoints)
+ (mpd-serialize-list-of-string "bind_to_address" endpoints)
+ ""))))
(address ; TODO: deprecated, remove later
maybe-string
"The address that mpd will bind to.
To use a Unix domain socket, an absolute path can be specified here."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(database
maybe-mpd-plugin
@@ -433,29 +433,29 @@ (define-configuration mpd-configuration
(inputs
(list-of-mpd-plugin '())
"List of MPD input plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "input" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "input" x))))
(archive-plugins
(list-of-mpd-plugin '())
"List of MPD archive plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))))
(input-cache-size
maybe-string
"MPD input cache size."
- (lambda (_ x)
- (if (maybe-value-set? x)
- #~(string-append "\ninput_cache {\n"
- #$(mpd-serialize-string "size" x)
- "}\n") "")))
+ (serializer (lambda (_ x)
+ (if (maybe-value-set? x)
+ #~(string-append "\ninput_cache {\n"
+ #$(mpd-serialize-string "size" x)
+ "}\n") ""))))
(decoders
(list-of-mpd-plugin '())
"List of MPD decoder plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "decoder" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "decoder" x))))
(resampler
maybe-mpd-plugin
@@ -464,8 +464,8 @@ (define-configuration mpd-configuration
(filters
(list-of-mpd-plugin '())
"List of MPD filter plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "filter" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "filter" x))))
(outputs
(list-of-mpd-plugin-or-output (list (mpd-output)))
@@ -475,8 +475,8 @@ (define-configuration mpd-configuration
(playlist-plugins
(list-of-mpd-plugin '())
"List of MPD playlist plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))))
(extra-options
(alist '())
@@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration
"Backend to use to detect changes in the @code{log-path}. The default is
'auto. To consult the defaults of the jail configuration, refer to the
@file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package."
- fail2ban-jail-configuration-serialize-backend)
+ (serializer fail2ban-jail-configuration-serialize-backend))
(max-retry
maybe-integer
"The number of failures before a host get banned
@@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration
maybe-symbol
"The encoding of the log files handled by the jail.
Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}."
- fail2ban-jail-configuration-serialize-log-encoding)
+ (serializer fail2ban-jail-configuration-serialize-log-encoding))
(log-path
(list-of-strings '())
"The file names of the log files to be monitored.")
@@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration
(text-config '())
"Extra content for the jail configuration, provided as a list of file-like
objects."
- serialize-text-config)
+ (serializer serialize-text-config))
(prefix fail2ban-jail-configuration-))
(define list-of-fail2ban-jail-configurations?
@@ -82,6 +82,9 @@ (define (custom-number-serializer name value)
(format #f "~a = ~a;" name value))
(define-configuration serializable-configuration
+ (port (number 80) "The port number." (serializer custom-number-serializer)))
+
+(define-configuration serializable-configuration-deprecated
(port (number 80) "The port number." custom-number-serializer))
(test-assert "serialize-configuration"
@@ -89,8 +92,14 @@ (define-configuration serializable-configuration
(let ((config (serializable-configuration)))
(serialize-configuration config serializable-configuration-fields))))
+(test-assert "serialize-configuration [deprecated]"
+ (gexp?
+ (let ((config (serializable-configuration-deprecated)))
+ (serialize-configuration
+ config serializable-configuration-deprecated-fields))))
+
(define-configuration serializable-configuration
- (port (number 80) "The port number." custom-number-serializer)
+ (port (number 80) "The port number." (serializer custom-number-serializer))
(no-serialization))
(test-assert "serialize-configuration with no-serialization"