Skip to content

Commit

Permalink
[COMM] notmuch -> mu4e
Browse files Browse the repository at this point in the history
  • Loading branch information
Icy-Thought committed Nov 11, 2024
1 parent b1487d9 commit a95c92a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 98 deletions.
2 changes: 1 addition & 1 deletion config/hyprland/pyprland.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ match_by = "title"

[scratchpads.Emacs-Mail]
use = "template"
command = "emacsclient -c -a '' -F '(quote (name . \"Emacs-NSP: Mail\"))' --eval '(notmuch-hello)'"
command = "emacsclient -c -a '' -F '(quote (name . \"Emacs-NSP: E-Mail\"))' --eval '(mu4e)'"
title = "Emacs-NSP|"
match_by = "title"

Expand Down
12 changes: 6 additions & 6 deletions config/xmonad/xmonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -759,11 +759,11 @@ myScratchpads = do
>-> setFrameName emacsScratchID
>-> eval (elispFun "dashboard-refresh-buffer")

notmuchSP <-
emacsMailSP <-
getInput $
inEditor
>-> setFrameName notmuchID
>-> eval (elispFun "notmuch-hello")
>-> setFrameName emacsMailID
>-> eval (elispFun "mu4e")

-- \| What matrix-client should've been..
matrixSP <-
Expand All @@ -784,7 +784,7 @@ myScratchpads = do
, NS "EasyEffects" "easyeffects" (title =? "Easy Effects") floatCenter
, NS "Emacs" emacsScratch (title ^? emacsScratchID) floatCenter
, NS "Matrix" matrixSP (title =? matrixID) floatCenter
, NS "NotMuch" notmuchSP (title =? notmuchID) floatCenter
, NS "Mail" emacsMailSP (title =? emacsMailID) floatCenter
, NS "Spotify" "spotify" (className =? "Spotify") floatCenter
, NS "System Monitor" btopLaunch (appName =? sysMonID) floatCenter
, NS "Telegram" telegramSP (title =? telegramID) floatCenter
Expand All @@ -793,7 +793,7 @@ myScratchpads = do
where
emacsScratchID = "Emacs-NSP|"
matrixID = "Emacs-NSP: Ement"
notmuchID = "Emacs-NSP: NotMuch"
emacsMailID = "Emacs-NSP: E-Mail"
telegramID = "Emacs-NSP: Telega"
sysMonID = "system-monitor"

Expand Down Expand Up @@ -946,7 +946,7 @@ addKeys conf@XConfig{modMask = modm} =
, ((modalt, xK_d), doScratchpad "Discord")
, ((modalt, xK_e), doScratchpad "Emacs")
, ((modalt, xK_k), doScratchpad "Matrix")
, ((modalt, xK_m), doScratchpad "NotMuch")
, ((modalt, xK_m), doScratchpad "Mail")
, ((modalt, xK_l), doScratchpad "Telegram")
, ((modalt, xK_s), doScratchpad "Spotify")
, ((modalt, xK_t), doScratchpad "Transmission")
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hosts/thinkpad-e595/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
};
communication = {
base.enable = true;
notmuch.enable = true;
matrix.withDaemon.enable = true;
mu4e.enable = true;
};
readers = {
enable = true;
Expand Down
17 changes: 9 additions & 8 deletions modules/desktop/editors/emacs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ in {
enable = true;
package = cfg.package;
extraPackages = epkgs:
attrValues ({
inherit (epkgs.melpaPackages) jinx pdf-tools;
inherit (epkgs.treesit-grammars) with-all-grammars;
telega = epkgs.melpaPackages.telega.overrideAttrs (_: {
[
epkgs.mu4e
epkgs.melpaPackages.jinx
epkgs.melpaPackages.pdf-tools
epkgs.treesit-grammars.with-all-grammars
(epkgs.melpaPackages.telega.overrideAttrs (_: {
version = "0.8.290";
src = pkgs.sources.telega;
});
} // optionalAttrs (cfg.terminal == "VTerm") {
inherit (epkgs.melpaPackages) vterm;
});
}))
] ++ optionalAttrs (cfg.terminal == "VTerm")
[ epkgs.melpaPackages.vterm ];
};

hm.services.emacs = {
Expand Down
87 changes: 15 additions & 72 deletions modules/desktop/toolset/communication.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ in {
inherit (lib.types) nullOr enum;
in {
base.enable = mkEnableOption "cross-platform clients";
notmuch.enable = mkEnableOption "NotMuch of an e-mail client";
mu4e.enable = mkEnableOption "a full-featured e-mail client";
discord.enable = mkEnableOption "discord client" // {
default = cfg.base.enable;
};
Expand Down Expand Up @@ -44,10 +44,9 @@ in {
user.packages = attrValues { inherit (pkgs) signal-desktop; };
})

(mkIf cfg.notmuch.enable {
(mkIf cfg.mu4e.enable {
hm.accounts.email = {
maildirBasePath = mailDir;

accounts.${config.user.name} = let mailAddr = "[email protected]";
in {
realName = "${config.user.name}";
Expand All @@ -65,85 +64,29 @@ in {
host = "disroot.org";
port = 465;
};

offlineimap.enable = true;
msmtp = {
enable = true;
extraConfig = { auth = "login"; };
};
notmuch.enable = true;

gpg = {
key = "2E690B8644FE29D8237F6C42B593E438DDAB3C66";
encryptByDefault = false;
signByDefault = true;
};
mbsync = {
enable = true;
create = "both";
expunge = "both";
patterns = [ "*" ];
};
msmtp = {
enable = true;
extraConfig.auth = "login";
};
mu.enable = true;
};
};

hm.programs = {
offlineimap.enable = true;
mbsync.enable = true;
msmtp.enable = true;
notmuch = {
enable = true;
hooks = {
preNew = "${lib.getExe pkgs.offlineimap} -o;";
postNew = "${lib.getExe pkgs.afew} --tag --new";
};
new.tags = [ "new" ];
};
afew = let
relMailDir = lib.strings.removePrefix "${config.user.home}/" mailDir;
in {
enable = true; # NotMuch initial tagging
extraConfig = ''
[SpamFilter]
[KillThreadsFilter]
[ListMailsFilter]
[DMARCReportInspectionFilter]
[InboxFilter]
[SentMailsFilter]
[ArchiveSentMailsFilter]
sent_tag = sent
[Filter.0]
message = Tagging Personal Emails
query = 'folder:${relMailDir}/'
tags = +personal
[FolderNameFilter.0]
folder_explicit_list = ${relMailDir}/Inbox ${relMailDir}/Archive ${relMailDir}/Drafts ${relMailDir}/Sent ${relMailDir}/Trash
folder_transforms = ${relMailDir}/Inbox:personal ${relMailDir}/Archive:personal ${relMailDir}/Drafts:personal ${relMailDir}/Sent:personal ${relMailDir}/Trash:personal
folder_lowercases = true
[FolderNameFilter.1]
folder_explicit_list = ${relMailDir}/Archive
folder_transforms = ${relMailDir}/Archive:archive
folder_lowercases = true
[FolderNameFilter.2]
folder_explicit_list = ${relMailDir}/Sent
folder_transforms = ${relMailDir}/Sent:sent
folder_lowercases = true
[FolderNameFilter.3]
folder_explicit_list = ${relMailDir}/Trash
folder_transforms = ${relMailDir}/Trash:deleted
folder_lowercases = true
[Filter.1]
message = Untagged 'inbox' from 'archive'
query = 'tag:archive AND tag:inbox'
tags = -inbox
[MailMover]
folders = ${relMailDir}/Inbox
rename = True
max_age = 7
${relMailDir}/Inbox = 'tag:deleted':${relMailDir}/Trash 'tag:archive':${relMailDir}/Archive
'';
};
mu.enable = true;
};
})

Expand Down

0 comments on commit a95c92a

Please sign in to comment.