]> git.ekhem.eu.org Git - guix.git/commitdiff
[emacs] Read and send email.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 23 Dec 2022 17:19:42 +0000 (18:19 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
This commit installs and configures clients for sending (`sendmail`)
and receiving (`notmuch`) email.

bash/.config/profile.d/50-notmuch.sh [new file with mode: 0644]
conf/home/emacs.scm
emacs/.config/emacs/conf/conf-email.el [new file with mode: 0644]

diff --git a/bash/.config/profile.d/50-notmuch.sh b/bash/.config/profile.d/50-notmuch.sh
new file mode 100644 (file)
index 0000000..aac77a7
--- /dev/null
@@ -0,0 +1,6 @@
+# Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# 50-notmuch.sh - environment variables for notmuch.
+
+export NOTMUCH_CONFIG="${XDG_CONFIG_HOME}/notmuch/notmuchrc"
index 719c72cfceb7c2e874f1a69ee4c3cefef3446a74..584b77b7a772d44b433b94fd81b90dfbcc08cde8 100644 (file)
@@ -11,6 +11,7 @@
   #:use-module (gnu packages emacs-xyz)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages mail)
   #:use-module (gnu packages password-utils)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages rust-apps)
            (dotfiles
             (list "emacs/.config/emacs/conf/conf-document.el")))))
 
+(define emacs-email-service
+  (service home-program-service-type
+          (home-program-configuration
+           (packages
+            (list emacs-notmuch
+                  isync
+                  msmtp
+                  notmuch))
+           (dotfiles
+            (list "bash/.config/profile.d/50-notmuch.sh"
+                  "emacs/.config/emacs/conf/conf-email.el")))))
+
 (define emacs-package-service
   (service home-program-service-type
           (home-program-configuration
        emacs-daemon-service
         emacs-dired-service
         emacs-document-service
+        emacs-email-service
         emacs-package-service
         emacs-pass-service
         emacs-service))
diff --git a/emacs/.config/emacs/conf/conf-email.el b/emacs/.config/emacs/conf/conf-email.el
new file mode 100644 (file)
index 0000000..7aa8432
--- /dev/null
@@ -0,0 +1,42 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; conf-email.el - configuration for the email client.
+
+(require 'conf-package)
+
+(use-package sendmail
+  :requires
+  (conf-crypt)
+  :when
+  (conf:executables-p (list "msmtp"))
+  :custom
+  ;; Use `sendmail' interface with `msmtp' backend.
+  (send-mail-function 'sendmail-send-it)
+  (sendmail-program "/usr/bin/msmtp")
+  ;; Use sender address from the `From' clause of the header.
+  (mail-specify-envelope-from t)
+  (message-sendmail-envelope-from 'header)
+  (mail-envelope-from 'header)
+  :config
+  ;; `dummy' is not a real password entry. It exists solely for this advices.
+  (define-advice message-send-mail-with-sendmail (:before ())
+    (password-store-get "dummy")))
+
+(use-package notmuch
+  :requires
+  (conf-crypt)
+  :when
+  (conf:executables-p (list "mbsync" "notmuch"))
+  :ensure t
+  :bind
+  ("C-c m" . notmuch)
+  :custom
+  (notmuch-archive-tags '("-inbox" "+archive"))
+  (notmuch-transient-prefix "?")
+  :config
+  ;; `dummy' is not a real password entry. It exists solely for this advices.
+  (define-advice notmuch-poll (:before ())
+    (password-store-get "dummy")))
+
+(provide 'conf-email)