diff options
author | Attila Lendvai <attila@lendvai.name> | 2022-08-24 14:40:41 +0200 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-08-25 00:10:32 -0400 |
commit | ee08277a70d29b6d707524a4e17620f50b87adf4 (patch) | |
tree | 3f10d2da5070e6687e58c0f4af68c2d1b73843c2 /gnu/services | |
parent | cc32cd41f74c642583837b43444646d52b3fd5da (diff) | |
download | guix-ee08277a70d29b6d707524a4e17620f50b87adf4.tar.gz |
services: Use the new maybe/unset API.
* gnu/home/services/ssh.scm (serialize-address-family): Use the public API of the maybe infrastructure. * gnu/services/file-sharing.scm (serialize-maybe-string): Use maybe-value. (serialize-maybe-file-object): Use maybe-value-set?. * gnu/services/getmail.scm (getmail-retriever-configuration): Don't use internals in unset field declarations. (getmail-destination-configuration): Ditto. * gnu/services/messaging.scm (raw-content?): Use maybe-value-set?. (prosody-configuration): Use %unset-value. * gnu/services/telephony.scm (jami-shepherd-services): Use maybe-value-set?. (archive-name->username): Use maybe-value-set?. * tests/services/configuration.scm ("maybe type, no default"): Use %unset-value. Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/file-sharing.scm | 11 | ||||
-rw-r--r-- | gnu/services/getmail.scm | 6 | ||||
-rw-r--r-- | gnu/services/kerberos.scm | 1 | ||||
-rw-r--r-- | gnu/services/messaging.scm | 15 | ||||
-rw-r--r-- | gnu/services/networking.scm | 2 | ||||
-rw-r--r-- | gnu/services/telephony.scm | 6 |
6 files changed, 22 insertions, 19 deletions
diff --git a/gnu/services/file-sharing.scm b/gnu/services/file-sharing.scm index 5df8b0d597..75e99f20b7 100644 --- a/gnu/services/file-sharing.scm +++ b/gnu/services/file-sharing.scm @@ -114,10 +114,7 @@ type generated and used by Transmission clients, suitable for passing to the ;; name-value pair for the JSON builder. (set! serialize-maybe-string (lambda (field-name val) - (serialize-string field-name - (if (eq? val 'unset) - "" - val)))) + (serialize-string field-name (maybe-value val "")))) (define (string-list? val) (and (list? val) @@ -180,9 +177,9 @@ type generated and used by Transmission clients, suitable for passing to the (define-maybe file-object) (set! serialize-maybe-file-object (lambda (field-name val) - (if (eq? val 'unset) - (serialize-string field-name "") - (serialize-file-object field-name val)))) + (if (maybe-value-set? val) + (serialize-file-object field-name val) + (serialize-string field-name "")))) (define (file-object-list? val) (and (list? val) diff --git a/gnu/services/getmail.scm b/gnu/services/getmail.scm index ce124f6b11..0a1c34cfd3 100644 --- a/gnu/services/getmail.scm +++ b/gnu/services/getmail.scm @@ -111,10 +111,10 @@ "The type of mail retriever to use. Valid values include @samp{passwd} and @samp{static}.") (server - (string 'unset) + string "Name or IP address of the server to retrieve mail from.") (username - (string 'unset) + string "Username to login to the mail server with.") (port (non-negative-integer #f) @@ -143,7 +143,7 @@ (define-configuration getmail-destination-configuration (type - (string 'unset) + string "The type of mail destination. Valid values include @samp{Maildir}, @samp{Mboxrd} and @samp{MDA_external}.") (path diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm index f845c1bd89..c3c7872734 100644 --- a/gnu/services/kerberos.scm +++ b/gnu/services/kerberos.scm @@ -39,6 +39,7 @@ +;; TODO Use %unset-value and the define-maybe infrastructure. (define unset-field (list 'unset-field)) (define (predicate/unset pred) diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index 00a1c80a14..59cb486778 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -90,6 +90,11 @@ ((new-def ...) (map (lambda (def target) (if (eq? 'common (syntax->datum target)) + ;; TODO Use the %unset-value variable, or + ;; even better just simplify this so that it + ;; doesn't interfere with + ;; define-configuration and define-maybe + ;; internals. #''unset def)) #'(def ...) #'(target ...))) ((new-doc ...) @@ -200,7 +205,7 @@ (define-maybe file-object-list) (define (raw-content? val) - (not (eq? val 'unset))) + (maybe-value-set? val)) (define (serialize-raw-content field-name val) val) (define-maybe raw-content) @@ -474,12 +479,12 @@ by the Prosody service. See @url{https://prosody.im/doc/logging}." global) (http-max-content-size - (maybe-non-negative-integer 'unset) + (maybe-non-negative-integer %unset-value) "Maximum allowed size of the HTTP body (in bytes)." common) (http-external-url - (maybe-string 'unset) + (maybe-string %unset-value) "Some modules expose their own URL in various ways. This URL is built from the protocol, host and port used. If Prosody sits behind a proxy, the public URL will be @code{http-external-url} instead. See @@ -556,7 +561,7 @@ support. To add an external component, you simply fill the hostname field. See int-component) (mod-muc - (maybe-mod-muc-configuration 'unset) + (maybe-mod-muc-configuration %unset-value) "Multi-user chat (MUC) is Prosody's module for allowing you to create hosted chatrooms/conferences for XMPP users. @@ -573,7 +578,7 @@ See also @url{https://prosody.im/doc/modules/mod_muc}." ext-component) (raw-content - (maybe-raw-content 'unset) + (maybe-raw-content %unset-value) "Raw content that will be added to the configuration file." common))) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 3c6395b6ca..9d85728371 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -772,7 +772,7 @@ logging is disabled.") network. A specific port value can be provided by appending the @code{:PORT} suffix. By default, it uses the Jami bootstrap nodes, but any host can be specified here. It's also possible to disable bootstrapping by explicitly -setting this field to the @code{'unset} value.") +setting this field to @code{%unset-value}.") (port (maybe-number 4222) "The UDP port to bind to. When left unspecified, an available port is diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index 7152f3b38d..3d855221e5 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -307,7 +307,7 @@ CONFIG, a <jami-configuration> object." (dbus (jami-configuration-dbus config)) (dbus-daemon (file-append dbus "/bin/dbus-daemon")) (accounts (jami-configuration-accounts config)) - (declarative-mode? (not (eq? 'unset accounts)))) + (declarative-mode? (maybe-value-set? accounts))) (with-extensions (list guile-packrat ;used by guile-ac-d-bus guile-ac-d-bus @@ -649,7 +649,7 @@ argument, either a registered username or the fingerprint of the account.") account-details) (let ((username (archive-name->username archive))) - (when (not (eq? 'unset allowed-contacts)) + (when (not (eq? '#$%unset-value allowed-contacts)) ;; Reject calls from unknown contacts. (set-account-details '(("DHT.PublicInCalls" . "false")) username) @@ -659,7 +659,7 @@ argument, either a registered username or the fingerprint of the account.") ;; Add allowed ones. (for-each (cut add-contact <> username) allowed-contacts)) - (when (not (eq? 'unset moderators)) + (when (not (eq? '#$%unset-value moderators)) ;; Disable the 'AllModerators' property. (set-all-moderators #f username) ;; Remove all moderators. |