diff --git a/home-linux.nix b/home-linux.nix index ff8f1e4..2fbb6fd 100644 --- a/home-linux.nix +++ b/home-linux.nix @@ -101,7 +101,7 @@ in services.mbsync = { enable = true; - frequency = "*:0/5"; # every 5 minutes + frequency = "*:0/15"; # every 15 minutes }; services.vdirsyncer = { diff --git a/home-mac.nix b/home-mac.nix index b28c8ba..751fe30 100644 --- a/home-mac.nix +++ b/home-mac.nix @@ -20,13 +20,23 @@ ''; }; + services.imapnotify.enable = true; + + # Add PATH to imapnotify service so it can find pass + launchd.agents.imapnotify-FastMail.config.EnvironmentVariables = { + PATH = "${pkgs.pass}/bin:${pkgs.gnupg}/bin:/usr/bin:/bin"; + }; + launchd.agents.mbsync = { enable = true; config = { ProgramArguments = [ "${pkgs.isync}/bin/mbsync" "-a" ]; - StartInterval = 300; # every 5 minutes + StartInterval = 900; # every 15 minutes StandardOutPath = "/tmp/mbsync.log"; StandardErrorPath = "/tmp/mbsync.err"; + EnvironmentVariables = { + PATH = "${pkgs.pass}/bin:${pkgs.gnupg}/bin:/usr/bin:/bin"; + }; }; }; @@ -37,6 +47,9 @@ StartInterval = 900; # every 15 minutes StandardOutPath = "/tmp/vdirsyncer.log"; StandardErrorPath = "/tmp/vdirsyncer.err"; + EnvironmentVariables = { + PATH = "${pkgs.pass}/bin:${pkgs.gnupg}/bin:/usr/bin:/bin"; + }; }; }; diff --git a/home-mail.nix b/home-mail.nix index df56c52..b03c7e3 100644 --- a/home-mail.nix +++ b/home-mail.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { programs.mbsync.enable = true; @@ -6,9 +6,32 @@ programs.himalaya.enable = true; programs.vdirsyncer.enable = true; programs.khard.enable = true; + programs.notmuch = { + enable = true; + new = { + tags = [ "new" ]; + }; + hooks = { + preNew = "mbsync -a"; + }; + }; + + accounts.email.accounts.FastMail.notmuch.enable = true; programs.aerc = { enable = true; - extraConfig.general.unsafe-accounts-conf = true; + extraConfig = { + general.unsafe-accounts-conf = true; + ui = { + mouse-enabled = true; + threading-enabled = true; + }; + compose = { + address-book-cmd = "khard email --parsable '%s'"; + }; + filters = { + "text/html" = "${pkgs.w3m}/bin/w3m -T text/html -cols $(tput cols) -dump -o display_image=false -o display_link_number=true"; + }; + }; }; accounts.email = { @@ -39,6 +62,16 @@ create = "maildir"; expunge = "maildir"; }; + imapnotify = { + enable = true; + boxes = [ "INBOX" ]; + onNotify = "${pkgs.isync}/bin/mbsync FastMail:INBOX"; + onNotifyPost = let + notifyCmd = if pkgs.stdenv.isDarwin + then "${pkgs.terminal-notifier}/bin/terminal-notifier -title 'New Mail' -message 'FastMail INBOX' -sound default" + else "${pkgs.libnotify}/bin/notify-send 'New Mail' 'FastMail INBOX'"; + in notifyCmd; + }; msmtp.enable = true; aerc.enable = true; himalaya = {