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/home | |
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/home')
-rw-r--r-- | gnu/home/services/ssh.scm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm index f0987aee23..d15f5ee912 100644 --- a/gnu/home/services/ssh.scm +++ b/gnu/home/services/ssh.scm @@ -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.") |