GNU bug report logs -
#66557
[PATCH] home: services: Add goimapnotify service.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi Nils,
On 2023-11-26 11:14, Nils Landt wrote:
> Bruno:
>> This isn't needed, fields whose maybe-values are unset don't call the
>> serializing procedures.
>
> combined with
>
>> You can use 'serialize-configuration' instead which accounts for the unset maybe-values.
>
> I put some time into this, but I don't see how serialize-configuration, which returns a gexp including string-append, could be used to turn a configuration record into the format required by guile-json.
Right, I missed that you are synthesizing a list for scm->json,
you will need to make use of the lower-level transducers in
(gnu services configuration).
The fstrim-service-type in (gnu services linux) provides a simple
example of its use though for your case you might be looking at
something like:
--8<---------------cut here---------------start------------->8---
;; note: untested snippet
(define (goimapnotify-files config)
(match-record config <home-goimapnotify-configuration>
(accounts)
(map (match-lambda
((path account)
(list path
(computed-file
(string-append "mail-imapnotify-config-"
(goimapnotify-account-host account))
(with-extensions (list guile-json-4)
#~(begin
(use-modules (json builder))
(with-output-to-file #$output
(lambda ()
(scm->json
(list #$@(list-transduce
(base-transducer account)
rcons
goimapnotify-account-fields)))
#:pretty #t))))))))
accounts)))
--8<---------------cut here---------------end--------------->8---
--
Furthermore, I consider that nonfree software must be eradicated.
Cheers,
Bruno.
[OpenPGP_signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 1 year and 195 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.