From bbb8267e6e60733529cb144d4a4e4d72d0a53bd0 Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Tue, 8 Jul 2025 14:24:17 -0400 Subject: [PATCH] split emails into two files --- hosts/android/home.nix | 2 +- hosts/desktop/home.nix | 2 +- hosts/macbook/home.nix | 2 +- hosts/macvm/home.nix | 2 +- hosts/thinkpad/home.nix | 2 +- modules/home-manager/email-personal.nix | 188 +++++++++++++++++++ modules/home-manager/email-work.nix | 113 +++++++++++ modules/home-manager/email.nix | 239 ------------------------ 8 files changed, 306 insertions(+), 244 deletions(-) create mode 100644 modules/home-manager/email-personal.nix create mode 100644 modules/home-manager/email-work.nix delete mode 100644 modules/home-manager/email.nix diff --git a/hosts/android/home.nix b/hosts/android/home.nix index e7e8ac5..d1791ef 100644 --- a/hosts/android/home.nix +++ b/hosts/android/home.nix @@ -12,7 +12,7 @@ ../../modules/home-manager/tmux.nix ../../modules/home-manager/bitwarden.nix ../../modules/home-manager/kubernetes.nix - ../../modules/home-manager/email.nix + ../../modules/home-manager/email-personal.nix ../../modules/home-manager/direnv.nix ../../modules/home-manager/emacs ]; diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 7ad9f93..d139f54 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -11,7 +11,7 @@ ../../modules/home-manager/zsh.nix ../../modules/home-manager/tmux.nix ../../modules/home-manager/taskwarrior.nix - ../../modules/home-manager/email.nix + ../../modules/home-manager/email-personal.nix ../../modules/home-manager/syncthing.nix ../../modules/home-manager/bitwarden.nix ../../modules/home-manager/kubernetes.nix diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index fd45928..d391d8a 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -10,7 +10,7 @@ ../../modules/home-manager/kitty.nix ../../modules/home-manager/zsh.nix ../../modules/home-manager/tmux.nix - ../../modules/home-manager/email.nix + ../../modules/home-manager/email-work.nix ../../modules/home-manager/password-store ../../modules/home-manager/taskwarrior.nix ../../modules/home-manager/kubernetes.nix diff --git a/hosts/macvm/home.nix b/hosts/macvm/home.nix index 4b1898a..ca834aa 100644 --- a/hosts/macvm/home.nix +++ b/hosts/macvm/home.nix @@ -14,7 +14,7 @@ ../../modules/home-manager/tmux.nix ../../modules/home-manager/taskwarrior.nix ../../modules/home-manager/stylix.nix - ../../modules/home-manager/email.nix + ../../modules/home-manager/email-personal.nix ../../modules/home-manager/syncthing.nix ../../modules/home-manager/bitwarden.nix ../../modules/home-manager/kubernetes.nix diff --git a/hosts/thinkpad/home.nix b/hosts/thinkpad/home.nix index f4e673c..d1b011b 100644 --- a/hosts/thinkpad/home.nix +++ b/hosts/thinkpad/home.nix @@ -13,7 +13,7 @@ ../../modules/home-manager/zsh.nix ../../modules/home-manager/tmux.nix ../../modules/home-manager/taskwarrior.nix - ../../modules/home-manager/email.nix + ../../modules/home-manager/email-personal.nix ../../modules/home-manager/syncthing.nix ../../modules/home-manager/bitwarden.nix ../../modules/home-manager/kubernetes.nix diff --git a/modules/home-manager/email-personal.nix b/modules/home-manager/email-personal.nix new file mode 100644 index 0000000..855f129 --- /dev/null +++ b/modules/home-manager/email-personal.nix @@ -0,0 +1,188 @@ +{ + pkgs, + osConfig, + lib, + ... +}: { + home.packages = with pkgs; [ + w3m + inetutils + ]; + + services = { +# mbsync = { +# enable = true; +# frequency = "*-*-* *:*/5:00"; +# postExec = "\${pkgs.notmuch} new"; +# }; + vdirsyncer = { + enable = true; +#frequency = "*-*-* *:*/5:00"; + }; + }; + + programs = { + aerc = { + enable = true; + extraConfig = { + ui = { + sort = "-r arrival"; + threading-enabled = true; + fuzzy-complete = true; + }; + general = { + default-save-path = "~/Downloads"; + log-file = "~/.aerc.log"; + unsafe-accounts-conf = true; + }; + compose = { + address-book-cmd = "notmuch address \"%s\""; + }; + filters = { + "text/plain" = "colorize"; + "text/calendar" = "calendar"; + "text/html" = "html | colorize"; + }; + }; + }; + msmtp = { + enable = true; + }; + mbsync = { + enable = true; + }; + lieer = { + enable = true; + }; + vdirsyncer = { + enable = true; + }; + khal = { + enable = true; + }; + khard = { + enable = true; + }; + mu = { + enable = true; + }; + notmuch = { + enable = true; + new.tags = [ "new" ]; + hooks = { + postNew = '' + notmuch tag +sent -new tag:new from:michael@michaelthomson.dev + + notmuch tag +cal attachment:.ics + + notmuch tag +inbox +unread -new "tag:new" + ''; + preNew = '' + mbsync -a + ''; + }; + }; + }; + + accounts = { + + email = { + accounts.personal = { + primary = true; + address = "michael@michaelthomson.dev"; + realName = "Michael Thomson"; + userName = "michael@michaelthomson.dev"; + passwordCommand = "rbw get --folder email michael@michaelthomson.dev"; + aerc = { + enable = true; + }; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + }; + imap = { + host = "mail.michaelthomson.dev"; + port = 993; + tls = { + enable = true; + }; + }; + msmtp = { + enable = true; + }; + smtp = { + host = "mail.michaelthomson.dev"; + port = 465; + tls = { + enable = true; + }; + }; + notmuch = { + enable = true; + }; + mu = { + enable = true; + }; + }; + }; + calendar = { + basePath = ".calendar"; + accounts.personal = { + primary = true; + primaryCollection = "personal"; + remote = { + type = "caldav"; + url = "https://nextcloud.michaelthomson.dev/remote.php/dav"; + userName = "michael@michaelthomson.dev"; + passwordCommand = [ + "rbw" + "get" + "nextcloud.michaelthomson.dev" + ]; + }; + vdirsyncer = { + enable = true; + auth = "basic"; + collections = ["personal"]; + }; + khal = { + enable = true; + type = "calendar"; + }; + }; + }; + contact = { + basePath = ".contacts"; + accounts.personal = { + local = { + type = "filesystem"; + fileExt = ".vcf"; + }; + remote = { + type = "carddav"; + url = "https://nextcloud.michaelthomson.dev/remote.php/dav"; + userName = "michael@michaelthomson.dev"; + passwordCommand = [ + "rbw" + "get" + "nextcloud.michaelthomson.dev" + ]; + }; + vdirsyncer = { + enable = true; + auth = "basic"; + collections = ["contacts"]; + }; + khal = { + enable = true; + collections = ["contacts"]; + }; + khard = { + enable = true; + defaultCollection = "contacts"; + }; + }; + }; + }; +} diff --git a/modules/home-manager/email-work.nix b/modules/home-manager/email-work.nix new file mode 100644 index 0000000..bf77928 --- /dev/null +++ b/modules/home-manager/email-work.nix @@ -0,0 +1,113 @@ +{ + pkgs, + osConfig, + lib, + ... +}: { + home.packages = with pkgs; [ + w3m + inetutils + ]; + + services = { +# mbsync = { +# enable = true; +# frequency = "*-*-* *:*/5:00"; +# postExec = "\${pkgs.notmuch} new"; +# }; + vdirsyncer = { + enable = true; +#frequency = "*-*-* *:*/5:00"; + }; + }; + + programs = { + aerc = { + enable = true; + extraConfig = { + ui = { + sort = "-r arrival"; + threading-enabled = true; + fuzzy-complete = true; + }; + general = { + default-save-path = "~/Downloads"; + log-file = "~/.aerc.log"; + unsafe-accounts-conf = true; + }; + compose = { + address-book-cmd = "notmuch address \"%s\""; + }; + filters = { + "text/plain" = "colorize"; + "text/calendar" = "calendar"; + "text/html" = "html | colorize"; + }; + }; + }; + msmtp = { + enable = true; + }; + mbsync = { + enable = true; + }; + lieer = { + enable = true; + }; + vdirsyncer = { + enable = true; + }; + khal = { + enable = true; + }; + khard = { + enable = true; + }; + mu = { + enable = true; + }; + notmuch = { + enable = true; + new.tags = [ "new" ]; + hooks = { + postNew = '' + notmuch tag +sent -new tag:new from:mthomson@konradgroup.com + + notmuch tag +cal attachment:.ics + + notmuch tag +inbox +unread -new "tag:new" + ''; + preNew = '' + cd ~/Maildir/work/ && gmi sync + ''; + }; + }; + }; + + accounts = { + email = { + accounts.work = { + primary = true; + flavor = "gmail.com"; + address = "mthomson@konradgroup.com"; + realName = "Michael Thomson"; + aerc = { + enable = true; + extraAccounts = { + source = "maildir://~/Maildir/work"; + }; + }; + notmuch = { + enable = true; + }; + lieer = { + enable = true; + settings = { + replace_slash_with_dot = true; + ignore_tags = [ "new" "personal" "work" ]; + }; + }; + }; + }; + }; +} diff --git a/modules/home-manager/email.nix b/modules/home-manager/email.nix deleted file mode 100644 index 82d93d2..0000000 --- a/modules/home-manager/email.nix +++ /dev/null @@ -1,239 +0,0 @@ -{ - pkgs, - osConfig, - lib, - ... -}: { - home.packages = with pkgs; [ - w3m - inetutils - ]; - - services = { - # mbsync = { - # enable = true; - # frequency = "*-*-* *:*/5:00"; - # postExec = "\${pkgs.notmuch} new"; - # }; - vdirsyncer = { - enable = true; - #frequency = "*-*-* *:*/5:00"; - }; - }; - - programs = { - aerc = { - enable = true; - extraConfig = { - ui = { - sort = "-r arrival"; - threading-enabled = true; - fuzzy-complete = true; - }; - general = { - default-save-path = "~/Downloads"; - log-file = "~/.aerc.log"; - unsafe-accounts-conf = true; - }; - compose = { - address-book-cmd = "notmuch address \"%s\""; - }; - filters = { - "text/plain" = "colorize"; - "text/calendar" = "calendar"; - "text/html" = "html | colorize"; - }; - }; - }; - msmtp = { - enable = true; - }; - mbsync = { - enable = true; - }; - lieer = { - enable = true; - }; - vdirsyncer = { - enable = true; - }; - khal = { - enable = true; - }; - khard = { - enable = true; - }; - mu = { - enable = true; - }; - }; - - programs.notmuch = lib.mkMerge [ - { - enable = true; - new.tags = [ "new" ]; - } - (lib.mkIf (osConfig.networking.hostName == "macbook") { - hooks = { - postNew = '' - notmuch tag +sent -new tag:new from:mthomson@konradgroup.com - - notmuch tag +cal attachment:.ics - - notmuch tag +inbox +unread -new "tag:new" - ''; - preNew = '' - cd ~/Maildir/work/ && gmi sync - ''; - }; - }) - (lib.mkIf (osConfig.networking.hostName != "macbook") { - hooks = { - postNew = '' - notmuch tag +sent -new tag:new from:michael@michaelthomson.dev - - notmuch tag +cal attachment:.ics - - notmuch tag +inbox +unread -new "tag:new" - ''; - preNew = '' - mbsync -a - ''; - }; - }) - ]; - - accounts = lib.mkMerge [ - (lib.mkIf (osConfig.networking.hostName == "macbook") { - email = { - accounts.work = { - primary = true; - flavor = "gmail.com"; - address = "mthomson@konradgroup.com"; - realName = "Michael Thomson"; - aerc = { - enable = true; - # extraBinds = { - # messages = { - # md = ":modify-labels +trash"; - # }; - # }; - extraAccounts = { - source = "maildir://~/Maildir/work"; - }; - }; - notmuch = { - enable = true; - }; - lieer = { - enable = true; - settings = { - replace_slash_with_dot = true; - ignore_tags = [ "new" "personal" "work" ]; - }; - }; - }; - }; - }) - (lib.mkIf (osConfig.networking.hostName != "macbook") { - email = { - accounts.personal = { - primary = true; - address = "michael@michaelthomson.dev"; - realName = "Michael Thomson"; - userName = "michael@michaelthomson.dev"; - passwordCommand = "rbw get --folder email michael@michaelthomson.dev"; - aerc = { - enable = true; - }; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - }; - imap = { - host = "mail.michaelthomson.dev"; - port = 993; - tls = { - enable = true; - }; - }; - msmtp = { - enable = true; - }; - smtp = { - host = "mail.michaelthomson.dev"; - port = 465; - tls = { - enable = true; - }; - }; - notmuch = { - enable = true; - }; - mu = { - enable = true; - }; - }; - }; - calendar = { - basePath = ".calendar"; - accounts.personal = { - primary = true; - primaryCollection = "personal"; - remote = { - type = "caldav"; - url = "https://nextcloud.michaelthomson.dev/remote.php/dav"; - userName = "michael@michaelthomson.dev"; - passwordCommand = [ - "rbw" - "get" - "nextcloud.michaelthomson.dev" - ]; - }; - vdirsyncer = { - enable = true; - auth = "basic"; - collections = ["personal"]; - }; - khal = { - enable = true; - type = "calendar"; - }; - }; - }; - contact = { - basePath = ".contacts"; - accounts.personal = { - local = { - type = "filesystem"; - fileExt = ".vcf"; - }; - remote = { - type = "carddav"; - url = "https://nextcloud.michaelthomson.dev/remote.php/dav"; - userName = "michael@michaelthomson.dev"; - passwordCommand = [ - "rbw" - "get" - "nextcloud.michaelthomson.dev" - ]; - }; - vdirsyncer = { - enable = true; - auth = "basic"; - collections = ["contacts"]; - }; - khal = { - enable = true; - collections = ["contacts"]; - }; - khard = { - enable = true; - defaultCollection = "contacts"; - }; - }; - }; - }) - ]; -}