nixos/pkgsets/emacs/mu4e.nix

122 lines
4.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
config,
lib,
pkgs,
...
}:
with lib; let
defaultEncrypt = pkgs.emacsPackages.trivialBuild rec {
pname = "defaultencrypt";
version = "ba07acc8e9fd692534c39c7cdad0a19dc0d897d9";
src = pkgs.fetchFromGitLab {
owner = "lechten";
repo = pname;
rev = version;
sha256 = "1ln7h1syx7yi7bqvirv90mk4rvwxg4zm1wvfcvhfh64s3hqrbfgl";
};
};
in
mkIf (elem "emacs::mu4e" config.machine.pkgs) {
programs.emacs.init.usePackage.pinentry = {
enable = true;
command = ["pinentry-start"];
hook = ["(after-init . pinentry-start)"];
};
programs.emacs.init.usePackage.mu4e = {
enable = true;
package = epkgs: null;
command = ["mu4e"];
diminish = ["mu4e-mode"];
hook = [
"(mu4e-view-mode . visual-line-mode)"
"(mu4e-compose-mode . flyspell-mode)"
'' (message-send . (lambda ()
(unless (yes-or-no-p "Send this message?")
(signal 'quit nil))))''
];
bind = {"\t" = "'company-complete-common";};
bindLocal = rec {
mu4e-headers-mode-map = {
"C-+" = "nil";
"C--" = "nil";
};
mu4e-view-mode-map = mu4e-headers-mode-map;
};
init = ''
;; (add-to-list 'load-path "${defaultEncrypt}/share/emacs/site-lisp")
;; (require 'jl-encrypt)
'';
config = ''
(setq mail-user-agent 'mu4e-user-agent)
(setq org-mu4e-link-query-in-headers-mode t)
(setq mu4e-maildir "~/.mail/Mail")
(setq mu4e-get-mail-command "${pkgs.isync}/bin/mbsync -a")
(setq mu4e-context-policy 'pick-first)
(setq mu4e-change-filenames-when-moving t)
(setq starttls-use-gnutls t)
(setq message-send-mail-function 'smtpmail-send-it)
(setq mu4e-update-interval 300)
(setq mu4e-use-fancy-chars t)
(setq mu4e-view-show-addresses t)
(setq mu4e-headers-show-threads t)
(setq mu4e-headers-skip-duplicates t)
(setq mail-user-agent 'mu4e-user-agent)
(defvaralias 'mu4e-compose-signature 'message-signature)
(setq-default mu4e-save-multiple-attachments-without-asking t)
(setq-default mu4e-view-show-addresses t)
(setq-default mu4e-confirm-quit nil)
(setq-default mu4e-hide-index-messages t)
(setq-default mu4e-index-update-in-background t)
(setq mu4e-compose-in-new-frame nil)
;;rename files when moving
;;NEEDED FOR MBSYNC
(setq mu4e-change-filenames-when-moving t)
(setq mu4e-html2text-command "iconv -c -t utf-8 | ${pkgs.pandoc}/bin/pandoc -f html -t plain")
(setq mu4e-view-show-images t)
(when (fboundp 'imagemagick-register-types)
(imagemagick-register-types))
(setq message-kill-buffer-on-exit t)
;; Encryption Stuff
;; (setq mml-secure-openpgp-sign-with-sender t)
;; ;; (setq mm-sign-option guided)
;; (setq epa-pinentry-mode 'loopback)
;; mailAcc config goes here
(load-file "~/.emacs.d/mu4e.el")
(defun my-browse-url-firefox-privately (url &optional new-window)
"Make firefox open URL in private-browsing window."
(interactive (browse-url-interactive-arg "URL: "))
(let ((process-environment (browse-url-process-environment)))
(apply 'start-process
(concat "firefox " url)
nil
browse-url-firefox-program
(list "-private-window" url))))
(setq browse-url-browser-function 'my-browse-url-firefox-privately)
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
'';
extraConfig = ''
:load-path "${pkgs.mu.mu4e}/share/emacs/site-lisp/mu4e"
'';
};
programs.emacs.init.usePackage.mu4e-alert = {
enable = true;
# hook = [ "after-init . mu4e-alert-enable-mode-line-display" ];
};
# programs.emacs.init.usePackage.org-mu4e = {
# enable = (elem "emacs::org" config.machine.pkgs);
# };
environment.systemPackages = with pkgs; [
mu
isync
];
}