email: add facility for email aliases

Also update the notmuch and alot modules to include support for email
aliases.
This commit is contained in:
Nick Hu 2019-04-10 12:50:44 +01:00 committed by Robert Helgesson
parent 30a16e3a87
commit a6f0fa90f7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 13 additions and 1 deletions

View file

@ -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";

View file

@ -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";

View file

@ -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 = {