all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: Nils Landt <nils@landt.email>
Cc: 66557@debbugs.gnu.org
Subject: [bug#66557] [PATCH] home: services: Add goimapnotify service.
Date: Wed, 29 Nov 2023 17:20:09 +0000	[thread overview]
Message-ID: <52947fbf-42c2-44e5-adf4-0b1bd66f56c0@makinata.eu> (raw)
In-Reply-To: <1635724009.68147.1700997260830@office.mailbox.org>


[-- Attachment #1.1: Type: text/plain, Size: 2017 bytes --]

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.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-29 17:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-15 14:01 [bug#66557] [PATCH] home: services: Add goimapnotify service Nils Landt
2023-11-02  8:55 ` Ricardo Wurmus
2023-11-20 17:16 ` Bruno Victal
2023-11-21 15:25   ` Nils Landt
2023-11-28 20:37     ` Bruno Victal
2023-11-21 15:30 ` Nils Landt
2023-11-26 10:31 ` Nils Landt
2023-11-26 11:14 ` Nils Landt
2023-11-29 17:20   ` Bruno Victal [this message]
2023-12-03 15:56     ` Nils Landt
2023-12-03 15:53 ` Nils Landt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52947fbf-42c2-44e5-adf4-0b1bd66f56c0@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=66557@debbugs.gnu.org \
    --cc=nils@landt.email \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.