From 36ee201aa168bd520e737d9c181fb87e28412d52 Mon Sep 17 00:00:00 2001 From: nathan mccarty Date: Sat, 2 Jul 2022 22:36:59 -0400 Subject: [PATCH] Setup mu4e --- doom.d/config.el | 15 +++++++++++++++ doom.d/config.org | 21 +++++++++++++++++++++ doom.d/init.el | 2 +- home-manager/programs/emacs.nix | 1 + home-manager/programs/sway.nix | 8 ++++---- home-manager/services/email.nix | 14 +++++++++++--- 6 files changed, 53 insertions(+), 8 deletions(-) diff --git a/doom.d/config.el b/doom.d/config.el index b4fc045..ea903c4 100644 --- a/doom.d/config.el +++ b/doom.d/config.el @@ -330,3 +330,18 @@ work if it thinks it needs to." elfeed-enclosure-default-dir (concat org-directory "elfeed/enclosures/") shr-max-width nil) (make-directory elfeed-db-directory t)) + +(after! mu4e + (setq sendmail-program (executable-find "msmtp") + send-mail-function #'smtpmail-send-it + message-sendmail-f-is-evil t + message-sendmail-extra-arguments '("--read-envelope-from") + message-send-mail-function #'message-send-mail-with-sendmail)) + +(set-email-account! "mccarty.io" + '((mu4e-sent-folder . "/nathan@mccarty.io/Sent") + (mu4e-drafts-folder . "/nathan@mccarty.io/Drafts") + (mu4e-trash-folder . "/nathan@mccarty.io/Trash") + (mu4e-refile-folder . "/nathan@mccarty.io/Archive") + (smtpmail-smtp-user . "nathan@mccarty.io")) + t) diff --git a/doom.d/config.org b/doom.d/config.org index e28e958..202d37e 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -528,3 +528,24 @@ Use ~elfeed~ for RSS. Doom provides most of the configuration, but we'll make a shr-max-width nil) (make-directory elfeed-db-directory t)) #+end_src +** Email +Use ~mu4e~ for email. Most of the bootstrap is provided by doom emacs. +First, tell mu4e to use msmtp +#+begin_src emacs-lisp +(after! mu4e + (setq sendmail-program (executable-find "msmtp") + send-mail-function #'smtpmail-send-it + message-sendmail-f-is-evil t + message-sendmail-extra-arguments '("--read-envelope-from") + message-send-mail-function #'message-send-mail-with-sendmail)) +#+end_src +Then tell it where our account's stuff is +#+begin_src emacs-lisp +(set-email-account! "mccarty.io" + '((mu4e-sent-folder . "/nathan@mccarty.io/Sent") + (mu4e-drafts-folder . "/nathan@mccarty.io/Drafts") + (mu4e-trash-folder . "/nathan@mccarty.io/Trash") + (mu4e-refile-folder . "/nathan@mccarty.io/Archive") + (smtpmail-smtp-user . "nathan@mccarty.io")) + t) +#+end_src diff --git a/doom.d/init.el b/doom.d/init.el index 8d47dd5..47020ee 100644 --- a/doom.d/init.el +++ b/doom.d/init.el @@ -91,7 +91,7 @@ (java +lsp +meghanada) (javascript +lsp) :email - ;;(mu4e +org +gmail) + (mu4e +org) ;;notmuch ;;(wanderlust +gmail) diff --git a/home-manager/programs/emacs.nix b/home-manager/programs/emacs.nix index b60e8b6..2ce90ca 100644 --- a/home-manager/programs/emacs.nix +++ b/home-manager/programs/emacs.nix @@ -33,6 +33,7 @@ }; }; }; + extraPackages = [ pkgs.mu ]; }; # Setup service services.emacs = { diff --git a/home-manager/programs/sway.nix b/home-manager/programs/sway.nix index 6a3282f..2997eb0 100644 --- a/home-manager/programs/sway.nix +++ b/home-manager/programs/sway.nix @@ -41,9 +41,9 @@ with lib; menu = "albert show"; # Use waybar, but through systemd bars = [ - # { - # command = "waybar"; - # } + # { + # command = "waybar"; + # } ]; # Use fira code fonts = { @@ -209,7 +209,7 @@ with lib; Unit = { Description = "Home Manager System Tray"; Requires = [ "graphical-session-pre.target" "waybar.service" ]; - After = ["waybar.service"]; + After = [ "waybar.service" ]; }; }; } diff --git a/home-manager/services/email.nix b/home-manager/services/email.nix index 303357c..7ba2cc8 100644 --- a/home-manager/services/email.nix +++ b/home-manager/services/email.nix @@ -7,7 +7,6 @@ with lib; { pass protonmail-bridge mu - xapian ]; # Configure protonmail as a service systemd.user.services.protonmail-bridge = { @@ -64,10 +63,15 @@ with lib; { create = "maildir"; }; mu.enable = true; + msmtp = { + enable = true; + }; }; }; }; - # Setup mbsync + ## Enable email applications + # Setup mbsync for incoming emails + # For fun reasons this requires enabling the program and the service programs.mbsync = { enable = true; }; @@ -75,9 +79,13 @@ with lib; { enable = true; postExec = "${pkgs.mu}/bin/mu index"; }; - # Setup mu + # Setup mu for indexing emails programs.mu = { enable = true; }; + # Setup msmtp for outbound emails + programs.msmtp = { + enable = true; + }; }; }