diff options
Diffstat (limited to '')
-rw-r--r-- | modules/common/profiles/email.nix | 142 |
1 files changed, 77 insertions, 65 deletions
diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix index 3c809af..a525692 100644 --- a/modules/common/profiles/email.nix +++ b/modules/common/profiles/email.nix @@ -5,45 +5,51 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.profiles.email; -in { - options.nixfiles.modules.profiles.email.enable = - mkEnableOption "Local Email management" // {default = this.isHeadful;}; +in +{ + options.nixfiles.modules.profiles.email.enable = mkEnableOption "Local Email management" // { + default = this.isHeadful; + }; config = mkIf cfg.enable { hm = { accounts.email = { maildirBasePath = "${config.my.home}/doc/mail"; - accounts = let - mkAccount = attrs: - mkMerge [ - { - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = ["*"]; - }; - msmtp.enable = true; - mu.enable = true; - thunderbird = { - enable = hasSuffix "linux" this.system; - settings = id: { - "mail.identity.id_${id}.compose_html" = false; - "mail.identity.id_${id}.reply_on_top" = 0; + accounts = + let + mkAccount = + attrs: + mkMerge [ + { + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ "*" ]; }; - }; - } - attrs - ]; + msmtp.enable = true; + mu.enable = true; + thunderbird = { + enable = hasSuffix "linux" this.system; + settings = id: { + "mail.identity.id_${id}.compose_html" = false; + "mail.identity.id_${id}.reply_on_top" = 0; + }; + }; + } + attrs + ]; - getPassword = { - path, - line ? 0, - }: - assert (builtins.isInt line); + getPassword = + { + path, + line ? 0, + }: + assert (builtins.isInt line); concatStringsSep " " ( [ (getExe config.hm.programs.password-store.package) @@ -57,48 +63,54 @@ in { "'${toString line}!d'" ] ); - in { - shire = mkAccount rec { - address = my.email; - aliases = [address "frodo@rohan.net" "azahi@shire.net"]; - realName = my.fullname; - gpg = { - inherit (my.pgp) key; - signByDefault = true; - encryptByDefault = false; - }; + in + { + shire = mkAccount rec { + address = my.email; + aliases = [ + address + "frodo@rohan.net" + "azahi@shire.net" + ]; + realName = my.fullname; + gpg = { + inherit (my.pgp) key; + signByDefault = true; + encryptByDefault = false; + }; - primary = true; + primary = true; - imap = { - host = "shire.net"; - port = 993; - tls.enable = true; - }; - smtp = { - host = "shire.net"; - port = 465; - tls.enable = true; + imap = { + host = "shire.net"; + port = 993; + tls.enable = true; + }; + smtp = { + host = "shire.net"; + port = 465; + tls.enable = true; + }; + userName = "azahi@shire.net"; + passwordCommand = getPassword { path = "email/shire.net/azahi"; }; }; - userName = "azahi@shire.net"; - passwordCommand = getPassword { - path = "email/shire.net/azahi"; - }; - }; - yahoo = mkAccount rec { - address = "admin@yahoo.com"; - aliases = [address "admin@yahoo.com"]; - realName = "Firstname Lastname"; + yahoo = mkAccount rec { + address = "admin@yahoo.com"; + aliases = [ + address + "admin@yahoo.com" + ]; + realName = "Firstname Lastname"; - flavor = "yahoo.com"; - userName = "admin@yahoo.com"; - passwordCommand = getPassword { - path = "email/yahoo.com/admin"; - line = 2; + flavor = "yahoo.com"; + userName = "admin@yahoo.com"; + passwordCommand = getPassword { + path = "email/yahoo.com/admin"; + line = 2; + }; }; }; - }; }; programs = { |