diff options
author | tdback <tyler@tdback.net> | 2025-01-20 19:40:28 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2025-01-20 19:40:28 -0500 |
commit | 97709964e4318d9226ca1188879e2b52b54771c4 (patch) | |
tree | 6f9bd02cd6f0da993a665cf1be10b939a625d057 | |
parent | 6deaea4cc8a4fcb5a3bb4fa9b0f60472452bfae6 (diff) |
feat: rework email module
-rw-r--r-- | users/tdback/desktop.nix | 2 | ||||
-rw-r--r-- | users/tdback/modules/email/default.nix | 136 | ||||
-rw-r--r-- | users/tdback/modules/git/default.nix | 12 | ||||
-rw-r--r-- | users/tdback/modules/neomutt/default.nix | 93 |
4 files changed, 99 insertions, 144 deletions
diff --git a/users/tdback/desktop.nix b/users/tdback/desktop.nix index 8302d7f..33950ca 100644 --- a/users/tdback/desktop.nix +++ b/users/tdback/desktop.nix @@ -33,7 +33,6 @@ in ./modules/irc ./modules/mpd ./modules/ncmpcpp - ./modules/neomutt ./modules/tmux ]; @@ -42,6 +41,7 @@ in gimp gitu mpv + nixd pciutils tidal-dl yt-dlp diff --git a/users/tdback/modules/email/default.nix b/users/tdback/modules/email/default.nix index 34eef65..37534db 100644 --- a/users/tdback/modules/email/default.nix +++ b/users/tdback/modules/email/default.nix @@ -1,77 +1,119 @@ -{ lib, pkgs, ... }: { - accounts.email = { - maildirBasePath = "mail"; - accounts.fastmail = { + config, + lib, + pkgs, + ... +}: +let + username = config.home.username; + email = "tyler@tdback.net"; + provider = "fastmail.com"; + mailboxes = lib.attrValues config.accounts.email.accounts.${username}.folders; +in +{ + accounts.email.maildirBasePath = "mail"; + accounts.email.accounts = { + ${username} = { primary = true; - address = "tyler@tdback.net"; - userName = "tyler@tdback.net"; + address = email; + userName = email; realName = "Tyler Dunneback"; passwordCommand = "${lib.getExe pkgs.age} -d -i ~/.ssh/mail ~/.mail.age"; - folders = { - inbox = "Inbox"; - drafts = "Drafts"; - sent = "Sent"; - trash = "Trash"; - }; - imap = { - host = "imap.fastmail.com"; + host = "imap.${provider}"; port = 993; - tls = { - enable = true; - certificatesFile = "/etc/ssl/certs/ca-certificates.crt"; - }; + tls.enable = true; }; smtp = { - host = "smtp.fastmail.com"; + host = "smtp.${provider}"; port = 465; - tls = { - enable = true; - useStartTls = false; - certificatesFile = "/etc/ssl/certs/ca-certificates.crt"; - }; + tls.enable = true; }; mbsync = { enable = true; create = "both"; - expunge = "none"; - subFolders = "Verbatim"; - patterns = [ "*" ]; }; msmtp = { enable = true; - extraConfig = { - logfile = "~/.cache/msmtp/msmtp.log"; - }; + extraConfig.logfile = "~/.cache/msmtp/msmtp.log"; }; neomutt = { enable = true; - sendMailCommand = "msmtp"; - mailboxType = "maildir"; - extraMailboxes = [ - "Drafts" - "Sent" - "Trash" - "Archive" - ]; + sendMailCommand = lib.getExe pkgs.msmtp; + extraMailboxes = mailboxes; }; }; }; - programs = { - mbsync.enable = true; - msmtp.enable = true; - }; + services.mbsync.enable = true; - services.mbsync = { - enable = true; - package = pkgs.isync; - frequency = "*:0/5"; - }; + programs.neomutt = + let + mkAction = + { + key, + action, + map ? [ + "index" + "pager" + ], + }: + { + inherit key action map; + }; + in + { + enable = true; + package = pkgs.unstable.neomutt; + vimKeys = true; + sort = "reverse-date"; + checkStatsInterval = 60; + sidebar.enable = true; + binds = [ + (mkAction { + key = "\\Cp"; + action = "sidebar-prev"; + }) + (mkAction { + key = "\\Cn"; + action = "sidebar-next"; + }) + (mkAction { + key = "\\Cy"; + action = "sidebar-open"; + }) + ]; + macros = [ + (mkAction { + key = "gi"; + action = "<change-folder>=Inbox<enter>"; + }) + (mkAction { + key = "gs"; + action = "<change-folder>=Sent<enter>"; + }) + (mkAction { + key = "gd"; + action = "<change-folder>=Drafts<enter>"; + }) + (mkAction { + key = "gt"; + action = "<change-folder>=Trash<enter>"; + }) + (mkAction { + key = "ga"; + action = "<change-folder>=Archive<enter>"; + }) + (mkAction { + map = [ "index" ]; + key = "S"; + action = "<shell-escape>${lib.getExe pkgs.isync} -a<enter>"; + }) + ]; + }; } diff --git a/users/tdback/modules/git/default.nix b/users/tdback/modules/git/default.nix index c608c6b..c9b3b6f 100644 --- a/users/tdback/modules/git/default.nix +++ b/users/tdback/modules/git/default.nix @@ -1,9 +1,15 @@ -{ ... }: +{ + config, + ... +}: +let + userName = config.home.username; + userEmail = config.accounts.email.accounts.${userName}.address or "tyler@tdback.net"; +in { programs.git = { enable = true; - userName = "tdback"; - userEmail = "tyler@tdback.net"; + inherit userName userEmail; extraConfig.init.defaultBranch = "main"; }; } diff --git a/users/tdback/modules/neomutt/default.nix b/users/tdback/modules/neomutt/default.nix deleted file mode 100644 index 413172a..0000000 --- a/users/tdback/modules/neomutt/default.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ pkgs, ... }: -{ - programs.neomutt = { - enable = true; - package = pkgs.unstable.neomutt; - - vimKeys = true; - sort = "reverse-date"; - - checkStatsInterval = 60; - - sidebar = { - enable = true; - shortPath = true; - width = 20; - }; - - binds = [ - { - map = [ - "index" - "pager" - ]; - key = "\\Cp"; - action = "sidebar-prev"; - } - { - map = [ - "index" - "pager" - ]; - key = "\\Cn"; - action = "sidebar-next"; - } - { - map = [ - "index" - "pager" - ]; - key = "\\Cy"; - action = "sidebar-open"; - } - ]; - - macros = [ - { - map = [ - "index" - "pager" - ]; - key = "gi"; - action = "<change-folder>=Inbox<enter>"; - } - { - map = [ - "index" - "pager" - ]; - key = "gs"; - action = "<change-folder>=Sent<enter>"; - } - { - map = [ - "index" - "pager" - ]; - key = "gd"; - action = "<change-folder>=Drafts<enter>"; - } - { - map = [ - "index" - "pager" - ]; - key = "gt"; - action = "<change-folder>=Trash<enter>"; - } - { - map = [ - "index" - "pager" - ]; - key = "ga"; - action = "<change-folder>=Archive<enter>"; - } - { - map = [ "index" ]; - key = "S"; - action = "<shell-escape>${pkgs.isync}/bin/mbsync -a<enter>"; - } - ]; - }; -} |