From a6f0fa90f73eab34744bd1dadbc73490e86be057 Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Wed, 10 Apr 2019 12:50:44 +0100 Subject: [PATCH] email: add facility for email aliases Also update the notmuch and alot modules to include support for email aliases. --- modules/accounts/email.nix | 7 +++++++ modules/programs/alot.nix | 3 +++ modules/programs/notmuch.nix | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix index ea9955d12..6bde6da0b 100644 --- a/modules/accounts/email.nix +++ b/modules/accounts/email.nix @@ -207,6 +207,13 @@ let description = "The email address of this account."; }; + aliases = mkOption { + type = types.listOf (types.strMatching ".*@.*"); + default = []; + example = [ "webmaster@example.org" "admin@example.org" ]; + description = "Alternative email addresses of this account."; + }; + realName = mkOption { type = types.str; example = "Jane Doe"; diff --git a/modules/programs/alot.nix b/modules/programs/alot.nix index 39c701e5c..341bb04a9 100644 --- a/modules/programs/alot.nix +++ b/modules/programs/alot.nix @@ -22,6 +22,9 @@ let sendmail_command = optionalString (alot.sendMailCommand != null) alot.sendMailCommand; } + // optionalAttrs (aliases != []) { + aliases = concatStringsSep "," aliases; + } // optionalAttrs (gpg != null) { gpg_key = gpg.key; encrypt_by_default = if gpg.encryptByDefault then "all" else "none"; diff --git a/modules/programs/notmuch.nix b/modules/programs/notmuch.nix index 1886aee39..e39747c8b 100644 --- a/modules/programs/notmuch.nix +++ b/modules/programs/notmuch.nix @@ -42,7 +42,9 @@ let in { name = catAttrs "realName" primary; primary_email = catAttrs "address" primary; - other_email = catAttrs "address" secondaries; + other_email = catAttrs "aliases" primary + ++ catAttrs "address" secondaries + ++ catAttrs "aliases" secondaries; }; search = {