From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id +LaDCe7/1mVPwwAA62LTzQ:P1 (envelope-from ) for ; Thu, 22 Feb 2024 09:03:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id +LaDCe7/1mVPwwAA62LTzQ (envelope-from ) for ; Thu, 22 Feb 2024 09:03:58 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=laesvuori.fi header.s=mail header.b=FdRbHtlZ; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=laesvuori.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708589038; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=AZQgVwuc6iRGpxNzhbKAuSz00C63kdhpUOyYTHnOT6w=; b=fR0IbUYB88kSi+Ta9ppc9kWsR+5+tdZDYDxEtFgkHxxYlBlqXbVwMtB1F00eAOOT7WCpQo azPWLw1pSqN95UZmv59YBS9k2lmA0dZLwl3/fPR5GgnTRRrLlYeU948dIwQ8BpCeLrJeUn gYJRcrTLY4+c9EFevls5CdY192hT+FY1CucQpxkqBN8ob3H000wNqYxVrKnleIYemvi+Vs iuS4HtG27Rw8fD7vj7EAhk+PPne/nfIJKsD5EdNPWPJkyA1hLS2TlzjnSt7tIkBIzeb1is aev/PggxRKr31QKMSV3+aSSCQrfa0k++3sMbjGEzCz4/LtX26wHANMn4lzD3hQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=laesvuori.fi header.s=mail header.b=FdRbHtlZ; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=laesvuori.fi ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708589038; a=rsa-sha256; cv=none; b=TDMaPUkh133evo8M8Ows+DUn+o6+YGC8uTIQ9Vy3Y2fljMZS0IU0l8UumQA2W8MVzP2dC8 NZTiqoUD5gMEB2+UtdEnCwjGHvzffrNqw6DQXVvddDrkv4R121OfL4MSORmX26mmIkLkSU sT6vafg8zAX7pCVMITut6DIcv+DuuKjGuuRFv0RbEkUKIf3KwysyIJ137T6U37K2e3rrFM yt3AFuLWzr5z8THQo9VX/6v+x+VduJFKyBOXpHa65/NdaVGaoB75PIFYmorupRaMNV2Q9a 4rSlucJBTuNbyRtu1OUuVoJEk1BoDgoL+gH1kOWATSWdfJD1pOi1aI8UBHeDZw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AF8FE6A207 for ; Thu, 22 Feb 2024 09:03:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rd43F-000541-6R; Thu, 22 Feb 2024 03:03:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd43B-00053o-IH for help-guix@gnu.org; Thu, 22 Feb 2024 03:03:25 -0500 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd439-0006Dc-Q1 for help-guix@gnu.org; Thu, 22 Feb 2024 03:03:25 -0500 Received: from X-kone (unknown [130.233.144.138]) by mail.laesvuori.fi (Postfix) with ESMTPSA id C90AD34302D; Thu, 22 Feb 2024 09:04:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1708589041; bh=dXZzcwDce9R2XD2wxxal2BjfL1UVHD5+ZH53t9WjC1M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=FdRbHtlZ/EVykynDX/nUnAIBFHmLwnNQQsn34rpTD5IdOyZZezmHBFBc7SL9JvGdD vJAE+chXAyRtXTHHDVoz5G25zd+4u6cz70BntAv2BpwPUQQzT3qnJI8UWD2VcKsk2G fnu2PCUodRbI7hMll3YWivoaLQpADNu9L/caUoxQ= Date: Thu, 22 Feb 2024 10:03:16 +0200 From: Saku Laesvuori To: Felix Lechner Cc: help-guix@gnu.org Subject: Re: Home service for mbsync? Message-ID: References: <87bk89ee80.fsf@lease-up.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="acekav2hrj7bebgo" Content-Disposition: inline In-Reply-To: <87bk89ee80.fsf@lease-up.com> Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.21 X-Spam-Score: -6.21 X-Migadu-Queue-Id: AF8FE6A207 X-TUID: s3aZlZt/04U2 --acekav2hrj7bebgo Content-Type: multipart/mixed; boundary="xdrthoxsbfpil2hy" Content-Disposition: inline --xdrthoxsbfpil2hy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > Does anyone have an 'mbsync' home service, please? Thanks! I use a service that combines mbsync and imapnotify. It's not quite ready yet (the code could be cleaner and it should provide a way to sync all mailboxes manually) but it's attached if you want to take a look. --xdrthoxsbfpil2hy Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mailsync.scm" (define-module (mailsync) #:use-module (gnu home services shepherd) #:use-module (gnu home services) #:use-module (gnu packages mail) #:use-module (gnu packages admin) #:use-module (gnu services configuration) #:use-module (guix gexp) #:use-module (guix records) #:use-module (srfi srfi-1) #:export (mailsync-mailbox mailsync-mailbox? home-mailsync-configuration home-mailsync-configuration? home-mailsync-service-type)) (define (string-list? x) (and (list? x) (every string? x))) (define (string-or-file-like? x) (or (string? x) (file-like? x))) (define-maybe/no-serialization string-or-file-like) (define-configuration/no-serialization mailsync-mailbox (host (string) "The hostname of the IMAP server to synchronise with.") (port (integer 993) "The port to use to connect to the IMAP server.") (tls? (boolean #t) "Whether to connect with IMAPS or not.") (password-command (string) "The command to run to get the IMAP password") (user (string) "The IMAP username.") (listen-boxes (string-list (list "INBOX")) "The mailboxes to listen for changes to.") (post-sync (maybe-string-or-file-like) "A command to run after syncing the mailbox.") (id (symbol) "An unique identifier for this mailbox.")) (define (make-imapnotify-config mailbox syncer-id) (match-record mailbox (host port tls? password-command user listen-boxes post-sync) #~(format #f "{\"host\": ~s, \"port\": ~a, \"tls\": ~a, \"username\": ~s, \"passwordCmd\": ~s, \"onNewMail\": ~s, \"onNewMailPost\": ~s, \"wait\": 3, \"boxes\": ~a}" #$host #$port #$(if tls? "true" "false") #$user #$password-command #$(file-append shepherd (string-append "/bin/herd start " (symbol->string syncer-id))) #$(if (maybe-value-set? post-sync) post-sync "") #$(format #f "[~a]" (string-join (map (lambda (x) (format #f "~s" x)) listen-boxes) ", "))))) (define (make-isync-config mailbox) (match-record mailbox (host port tls? password-command user id) (format #f "IMAPAccount account Host ~a User ~a PassCmd ~s SSLType ~a IMAPStore remote Account account MaildirStore local SubFolders Verbatim Path ~~/.mail/~a/ Inbox ~~/.mail/~a/Inbox Channel channel Far :remote: Near :local: Create Both Expunge Both SyncState * Patterns *\n" host user password-command (if tls? "IMAPS" "STARTTLS") id id))) (define (mailsync-mailbox-list? x) (and (list? x) (every mailsync-mailbox? x))) (define-configuration/no-serialization home-mailsync-configuration (isync (file-like isync) "The @code{isync} package to use.") (goimapnotify (file-like go-gitlab.com-shackra-goimapnotify) "The @code{goimapnotify} package to use.") (mailboxes (mailsync-mailbox-list '()) "The mailboxes to synchronise.")) (define (home-mailsync-shepherd-service config) (match-record config (isync goimapnotify mailboxes) (apply append (map (lambda (mailbox) (let* ((id (mailsync-mailbox-id mailbox)) (syncer-id (symbol-append 'mailsync-syncer- id)) (listener-id (symbol-append 'mailsync-listener- id)) (isync-config-file (mixed-text-file "mbsyncrc" (make-isync-config mailbox))) (imapnotify-config-file (mixed-text-file "imapnotify-config.json" (make-imapnotify-config mailbox syncer-id)))) (list (shepherd-service (provision (list syncer-id)) (requirement '()) (one-shot? #t) (start #~(make-forkexec-constructor (list #$(file-append isync "/bin/mbsync") "--all" "--quiet" "--config" #$isync-config-file))) (actions (list (shepherd-configuration-action isync-config-file)))) (shepherd-service (provision (list listener-id)) (requirement (list syncer-id)) (one-shot? #f) (start #~(make-forkexec-constructor (list #$(file-append goimapnotify "/bin/goimapnotify") "-conf" #$imapnotify-config-file))) (stop #~(make-kill-destructor)) (actions (list (shepherd-configuration-action imapnotify-config-file))))))) mailboxes)))) (define home-mailsync-service-type (service-type (name 'home-mailsync) (extensions (list (service-extension home-shepherd-service-type home-mailsync-shepherd-service))) (default-value (home-mailsync-configuration)) (description "Sync email over imap with isync and imapnotify."))) --xdrthoxsbfpil2hy-- --acekav2hrj7bebgo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmXW/8QACgkQJX0oSiod OjJhWxAAkWjeY98YR8vSvnrysiIc2TGl89TV1Jgq2FNDGExTqKD/UmtTBNibZJbR SZ7bnVQ9addl+bs6dQfSKrto9oC1Nid+ckWAiXBcF1Fi279f0n+8xwWw5SUIH87W z7D2D9aEWN/MHay5vsW6uXK85gdCkAmvt2qTD5qPaERIC2YfYgFruUhdELYkdXA9 ca+13PJvnIk8mQwwn55stoIbmY4R+R9LxOzhxczynovW6suWjMvj+efZhbAWtzDr yOkGUGqZyEKjO9doDk83EdMKFOkRrWyzNW5icJRAH5P3KAIp+SDqm7pHSQi6Y/ub 9JE5hYOHscsTvKFPWQ9uJywG49C8p/8pPaYNTiDrJ7WwHkiaEssQbGUGaI7DAh2E JLtGdWAqCHEnW86JfLGTQDvD50TPYkfo2ZdPZC76uAVHcNpHBikJcfwWWXjzq/XL Y4EVB7N9kYQNV74staMe6MWdV7PoOTKDj5FbtJoL+iLxYYIDv39gpyKbgTOvuC5G KyhxTW2tWHTNoYgzWHHrDS67DlPxONz1ZBZUE9aYSGL8rEvsDxanDCYp+tr3c3eO HipfYjk1fUo2qHBgcx9Uia5xbScfNsNOVUQeQRNr6XfH6hov/GWdjjlJGTja5vvY 7Bg98WrQgdbE/HLaTep13hf30c476IBUnj+4x5TGNnHc9v90I0g= =TF4U -----END PGP SIGNATURE----- --acekav2hrj7bebgo--