provide 'cce/mbsync)
(defun cce-run-mbsync-forever ()
(
(interactive)"date && mbsync -a" "*mbsync*" 600))
(cce/async-forever #'after-cce-hook #'cce-run-mbsync-forever) (add-hook
I have mixed feelings about using mbsync in my Email and News and Information Pipelines, I've had enough issues with mail integrity that it's useful to have a Python thing that I can muck around inside of with print statements to figure out what what the fuck my Maildir did to itself. I have negative feelings towards the way the project is operated, and the fact that the best documentation of the project is bunch of semi-hostile threads on a Sourceforge forum, and I'm not excited for Master/Slave terminology in a sync program…
But it's fast and works and so I'll try to use it again. I have a tiered architecture for my mail; because of the Universal Aggregator, on my laptops I want to always pull my mail from my central server, and so I have two configurations.
Here's the one for getting things from my server to my laptop. Most
folks who set up a personal mail cache will configure Dovecot on the
server to listen on a port, and set up authentication and firewalling
and bla bla bla. Even if you have a VPN and manage to make sure your
IMAP server is only on that VPN, you have to set up a password database
or some other sort of authentication strategy, fucken sucks. Instead, I
build my security on top of my SSH
Configuration1, by establishing an SSH tunnel which
executes the built-in imap
library
executable, which provides a locally-authenticated dovecot session over
standard input/output.
{ config, pkgs, ... }:
{
imports = [
./mbsync-configuration.nix
./imapnotify-configuration.nix
];
programs.mbsync.enable = true;
accounts.email.maildirBasePath = "/home/rrix/Maildir";
accounts.email.accounts.fastmail = {
address = "ryan@whatthefuck.computer";
# aliases = [ "ry@n.rix.si" "rrix@fastmail.com" ];
userName = "rrix@fastmail.com";
passwordCommand = "${pkgs.rbw}/bin/rbw get fastmail_email_app";
maildir.path = "fastmail";
imap = {
host = "mail.messagingengine.com";
};
};
}
The last time I used mbsync
, I
experienced issues with mail IDs in my newsrc.eld
file, which Gnus uses to store which
lists I am subscribed too, and also functions as a cache for message and
folder states. The latter caching was what caused these issues, I
believe, but it was really difficult to debug it. If this happens again,
I may switch to offlineimap.
{ config, pkgs, ... }:
{
services.imapnotify.enable = true;
accounts.email.accounts.fastmail.imapnotify = {
enable = true;
boxes = ["INBOX"];
onNotify = ''
set -euxo pipefail
${pkgs.imapfilter}/bin/imapfilter -c ${<arroyo/files/imapfilter.lua>}
${pkgs.isync}/bin/mbsync -a
${pkgs.libnotify}/bin/notify-send 'New mail received'
'';
};
}
{ config, pkgs, ... }:
{
accounts.email.accounts.fastmail.mbsync = {
enable = true;
subFolders = "Verbatim";
extraConfig = {
account = {
Timeout = 120;
};
};
groups = {
all = {
channels = {
top = {
extraConfig.Create = "near";
patterns = [
"INBOX"
"1ml"
"1ml/bcz"
"1ml/friendsofsecurityplanner"
"Junk Mail"
"RecruitingSpam"
"Sent Mail"
"emacsconf"
"fedora/bugs"
"github"
"newsletters"
"phoenix-lug"
"social"
];
};
rest = {
extraConfig.Create = "near";
patterns = [
"*"
];
};
};
};
};
};
}