mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
cc32cd41f7
commit
ee08277a70
8 changed files with 30 additions and 25 deletions
|
@ -69,17 +69,19 @@
|
|||
" " value "\n"))
|
||||
|
||||
(define (address-family? obj)
|
||||
(memv obj (list 'unset AF_INET AF_INET6)))
|
||||
(memv obj (list AF_INET AF_INET6)))
|
||||
|
||||
(define-maybe address-family)
|
||||
|
||||
(define (serialize-address-family field family)
|
||||
(if (eq? 'unset family)
|
||||
""
|
||||
(if (maybe-value-set? family)
|
||||
(string-append " " (serialize-field-name field) " "
|
||||
(cond ((= family AF_INET) "inet")
|
||||
((= family AF_INET6) "inet6")
|
||||
;; The 'else' branch is unreachable.
|
||||
(else (raise (condition (&error)))))
|
||||
"\n")))
|
||||
"\n")
|
||||
""))
|
||||
|
||||
(define (natural-number? obj)
|
||||
(and (integer? obj) (exact? obj) (> obj 0)))
|
||||
|
@ -115,7 +117,7 @@
|
|||
maybe-string
|
||||
"Host name---e.g., @code{\"foo.example.org\"} or @code{\"192.168.1.2\"}.")
|
||||
(address-family
|
||||
address-family
|
||||
maybe-address-family
|
||||
"Address family to use when connecting to this host: one of
|
||||
@code{AF_INET} (for IPv4 only), @code{AF_INET6} (for IPv6 only).
|
||||
Additionally, the field can be left unset to allow any address family.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue