From 98d41aa9374b033f194f940ba3983babc29e5ef8 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 7 Nov 2018 12:15:57 -0800 Subject: Configure email --- home.nix | 97 +++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 38 deletions(-) (limited to 'home.nix') diff --git a/home.nix b/home.nix index 0c4acb2..6a7c5c6 100644 --- a/home.nix +++ b/home.nix @@ -5,35 +5,38 @@ let homedir = builtins.getEnv "HOME"; in { - # Waiting for the accounts feature to land in the 18.03 release branch... - # - #accounts = { - # email = { - # maildirBasePath = "$HOME/Mail"; - # accounts = { - # "ben@bsima.me" = { - # primary = true; - # realName = "Ben Sima"; - # address = "ben@bsima.me"; - # folders = { - # inbox = "INBOX"; - # }; - # imap = { - # host = "mail.bsima.me"; - # port = 993; - # }; - # smtp = { - # host = "mail.bsima.me"; - # port = 587; - # }; - # userName = "ben@bsima.me"; - # mbsync.enable = true; - # notmuch.enable = true; - # passwordCommand = "pass bnet/helium/mail/ben"; - # }; - # }; - # }; - #}; + accounts = { + email = { + maildirBasePath = "${homedir}/Mail"; + accounts = { + "ben@bsima.me" = { + primary = true; + realName = "Ben Sima"; + address = "ben@bsima.me"; + folders = { + inbox = "INBOX"; + }; + imap = { + host = "mail.bsima.me"; + port = 993; + }; + smtp = { + host = "mail.bsima.me"; + port = 587; + }; + userName = "ben@bsima.me"; + mbsync = { + enable = true; + create = "both"; + expunge = "none"; + }; + notmuch.enable = true; + msmtp.enable = false; + passwordCommand = "pass bnet/helium/mail/ben"; + }; + }; + }; + }; home = { packages = import ./packages.nix { inherit pkgs; }; sessionVariables = { @@ -52,14 +55,6 @@ in source = ./mailcap; target = ".mailcap"; }; - msmtp = { - source = ./msmtprc; - target = ".msmtprc"; - }; - notmuch = { - source = ./notmuch; - target = ".notmuch-config"; - }; tmux = { source = ./tmux; target = ".tmux.conf"; @@ -149,6 +144,10 @@ in enable = true; defaultCacheTtl = 600; enableSshSupport = true; + extraConfig = '' + allow-emacs-pinentry + pinentry-program /home/ben/.nix-profile/bin/pinentry-tty + ''; }; }; @@ -271,6 +270,28 @@ in firefox = { enable = true; }; - }; + notmuch = { + enable = true; + new.tags = [ "unread" "inbox" ]; + hooks = { + preNew = "mbsync --all"; + postNew = builtins.readFile ./notmuch-hook.sh; + }; + extraConfig = { + search = { + exclude_tags = "deleted;spam;"; + }; + }; + }; + + mbsync = { + enable = true; + }; + + msmtp = { + enable = false; + extraConfig = builtins.readFile ./msmtprc; + }; + }; } -- cgit v1.2.3