implement alias list
This commit is contained in:
parent
a17093b867
commit
d94b8acd78
|
@ -61,8 +61,9 @@ in
|
|||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = with types; listOf types.str;
|
||||
example = ["abuse@example.com" "postmaster@example.com"];
|
||||
default = [];
|
||||
description = ''
|
||||
A list of aliases of this login account.
|
||||
'';
|
||||
|
|
|
@ -23,12 +23,20 @@ let
|
|||
cfg = config.mailserver;
|
||||
|
||||
# valiases_postfix :: [ String ]
|
||||
valiases_postfix = map
|
||||
valiases_postfix = lib.flatten (lib.mapAttrsToList
|
||||
(name: value:
|
||||
let to = name;
|
||||
in map (from: "${from} ${to}") value.aliases)
|
||||
cfg.loginAccounts);
|
||||
|
||||
# extra_valiases_postfix :: [ String ]
|
||||
extra_valiases_postfix = map
|
||||
(from:
|
||||
let to = cfg.virtualAliases.${from};
|
||||
in "${from} ${to}")
|
||||
(builtins.attrNames cfg.virtualAliases);
|
||||
|
||||
|
||||
# accountToIdentity :: User -> String
|
||||
accountToIdentity = account: "${account.name} ${account.name}";
|
||||
|
||||
|
@ -36,7 +44,7 @@ let
|
|||
vaccounts_identity = map accountToIdentity (lib.attrValues cfg.loginAccounts);
|
||||
|
||||
# valiases_file :: Path
|
||||
valiases_file = builtins.toFile "valias" (lib.concatStringsSep "\n" valiases_postfix);
|
||||
valiases_file = builtins.toFile "valias" (lib.concatStringsSep "\n" extra_valiases_postfix);
|
||||
|
||||
# vhosts_file :: Path
|
||||
vhosts_file = builtins.toFile "vhosts" (concatStringsSep "\n" cfg.domains);
|
||||
|
@ -47,7 +55,8 @@ let
|
|||
# for details on how this file looks. By using the same file as valiases,
|
||||
# every alias is owned (uniquely) by its user. We have to add the users own
|
||||
# address though
|
||||
vaccounts_file = builtins.toFile "vaccounts" (lib.concatStringsSep "\n" (vaccounts_identity ++ valiases_postfix));
|
||||
vaccounts_file = builtins.toFile "vaccounts" (lib.concatStringsSep "\n"
|
||||
(vaccounts_identity ++ extra_valiases_postfix));
|
||||
|
||||
submissionHeaderCleanupRules = pkgs.writeText "submission_header_cleanup_rules" ''
|
||||
# Removes sensitive headers from mails handed in via the submission port.
|
||||
|
|
Loading…
Reference in New Issue