--- /dev/null
+# 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"
#: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))
--- /dev/null
+;; 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)