[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#66557] [PATCH] home: services: Add goimapnotify service.
From: |
Bruno Victal |
Subject: |
[bug#66557] [PATCH] home: services: Add goimapnotify service. |
Date: |
Wed, 29 Nov 2023 17:20:09 +0000 |
User-agent: |
Mozilla Thunderbird |
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
Description: OpenPGP digital signature