Merge options virtualAccountAliases and virtualDomainAliases into virtualAliases
Some checks failed
Test / tests (push) Failing after 2m59s
Some checks failed
Test / tests (push) Failing after 2m59s
This commit is contained in:
parent
faf6f549b0
commit
bae52b2220
3 changed files with 48 additions and 56 deletions
|
|
@ -126,43 +126,43 @@ in {
|
|||
default = {};
|
||||
};
|
||||
|
||||
virtualDomainAliases = lib.mkOption {
|
||||
type = with lib.types; attrsOf str;
|
||||
example = {
|
||||
"aliasdomain.com" = "domain.com";
|
||||
};
|
||||
description = ''
|
||||
Virtual aliasing of domains. A virtual alias `"aliasdomain.com" = "domain.com"`
|
||||
means that all mail directed at `@aliasdomain.com` are forwarded to `@domain.com`.
|
||||
This also entails, that any account or alias of `domain.com` is partially valid
|
||||
for `aliasdomain.com`. For example, `user@domain.com` can receive mails at
|
||||
`user@aliasdomain.com`. However, if `user@domain.com` shall be able to dispatch
|
||||
mails using `user@aliasdomain.com`, an explicit alias needs to be configured.
|
||||
'';
|
||||
default = {};
|
||||
};
|
||||
|
||||
virtualAccountAliases = lib.mkOption {
|
||||
virtualAliases = lib.mkOption {
|
||||
type = let
|
||||
isAccount = value: builtins.elem value (builtins.attrNames cfg.accounts);
|
||||
isDomain = value: !(lib.hasInfix "@" value) && (builtins.elem value cfg.domains);
|
||||
account = lib.mkOptionType {
|
||||
name = "Mail Account";
|
||||
check = account: builtins.elem account (builtins.attrNames cfg.accounts);
|
||||
check = isAccount;
|
||||
};
|
||||
accountOrDomain = lib.mkOptionType {
|
||||
name = "Mail Account or Domain";
|
||||
check = value: (isAccount value) || (isDomain value);
|
||||
};
|
||||
in
|
||||
with lib.types; attrsOf (either account (nonEmptyListOf account));
|
||||
with lib.types; attrsOf (either (nonEmptyListOf account) accountOrDomain);
|
||||
example = {
|
||||
"info@example.com" = "user1@example.com";
|
||||
"postmaster@example.com" = "user1@example.com";
|
||||
"abuse@example.com" = "user1@example.com";
|
||||
"multi@example.com" = ["user1@example.com" "user2@example.com"];
|
||||
"aliasdomain.com" = "domain.com";
|
||||
};
|
||||
description = ''
|
||||
Virtual account aliases. A virtual alias `"info@example.com" = "user1@example.com"`
|
||||
means that all mail to `info@example.com` is forwarded to `user1@example.com`.
|
||||
Furthermore, it also allows the user `user1@example.com` to send emails as
|
||||
`info@example.com`. It is also possible to create an alias for multiple accounts.
|
||||
In this example, all mails for `multi@example.com` will be forwarded to both
|
||||
`user1@example.com` and `user2@example.com`.
|
||||
Virtual account and domain aliases. A virtual alias means, that all mail directed
|
||||
at a given target are forwarded to the specified other destinations, too.
|
||||
|
||||
For account aliases, this means that, e.g., `"user1@example.com"` receives all mail
|
||||
sent to `"info@example.com"`. In addition, `"user1@example.com"` is also able to
|
||||
impersonate `"info@example.com"` when sending mails. It is also possible to create
|
||||
an alias for multiple accounts. In this example, all mails for `"multi@example.com"`
|
||||
will be forwarded to both
|
||||
`"user1@example.com"` and `"user2@example.com"`.
|
||||
|
||||
For domain aliases, this means that all mails directed at an aliased domain, e.g.,
|
||||
`"aliasdomain.com"` are forwarded to `"domain.com"` This also entails, that any
|
||||
account or alias of `"domain.com"` receives mails directed at `"aliasdomain.com"`.
|
||||
However, if `"user@domain.com"` shall be able to send mails using
|
||||
`"user@aliasdomain.com"`, an explicit alias needs to be configured.
|
||||
'';
|
||||
default = {};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue