mailsystem: Add basic postfix configuration
This commit is contained in:
parent
bc01d4d2d0
commit
b7fac23bd1
3 changed files with 268 additions and 1 deletions
|
|
@ -1,4 +1,10 @@
|
|||
{lib, ...}: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.mailsystem;
|
||||
in {
|
||||
options.mailsystem = {
|
||||
enable = lib.mkEnableOption "nixos-mailsystem";
|
||||
|
||||
|
|
@ -14,6 +20,32 @@
|
|||
description = "Fully qualified domain name of the mail server.";
|
||||
};
|
||||
|
||||
reverseFqdn = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = cfg.fqdn;
|
||||
defaultText = lib.literalMD "{option}`mailsystem.fqdn`";
|
||||
example = "server.example.com";
|
||||
description = ''
|
||||
Fully qualified domain name used by the server to identify
|
||||
with other servers.
|
||||
|
||||
This needs to be set to the same value of the server's IP reverse DNS.
|
||||
'';
|
||||
};
|
||||
|
||||
domains = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
example = ["example.com"];
|
||||
default = [];
|
||||
description = "List of domains to be served by the mail server";
|
||||
};
|
||||
|
||||
messageSizeLimit = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 64 * 1024 * 1024;
|
||||
description = "Maximum accepted mail size";
|
||||
};
|
||||
|
||||
vmailUID = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 5000;
|
||||
|
|
@ -60,6 +92,17 @@
|
|||
'';
|
||||
};
|
||||
|
||||
aliases = lib.mkOption {
|
||||
type = with lib.types; listOf types.str;
|
||||
example = ["abuse@example.com" "postmaster@example.com"];
|
||||
default = [];
|
||||
description = ''
|
||||
A list of aliases of this login account.
|
||||
Note: Use list entries like "@example.com" to create a catchAll
|
||||
that allows sending from all email addresses in these domain.
|
||||
'';
|
||||
};
|
||||
|
||||
isSystemUser = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
|
|
@ -83,11 +126,40 @@
|
|||
description = "All available login account for the mailsystem.";
|
||||
default = {};
|
||||
};
|
||||
|
||||
extraVirtualAliases = lib.mkOption {
|
||||
type = let
|
||||
account = lib.mkOptionType {
|
||||
name = "Login Account";
|
||||
check = account: builtins.elem account (builtins.attrNames cfg.accounts);
|
||||
};
|
||||
in
|
||||
with lib.types; attrsOf (either account (nonEmptyListOf account));
|
||||
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"];
|
||||
};
|
||||
description = ''
|
||||
Virtual Aliases. A virtual alias `"info@example.com" = "user1@example.com"` means that
|
||||
all mail to `info@example.com` is forwarded to `user1@example.com`. Note
|
||||
that it is expected that `postmaster@example.com` and `abuse@example.com` is
|
||||
forwarded to some valid email address. (Alternatively you can create login
|
||||
accounts for `postmaster` and (or) `abuse`). Furthermore, it also allows
|
||||
the user `user1@example.com` to send emails as `info@example.com`.
|
||||
It's 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`.
|
||||
'';
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./dovecot.nix
|
||||
./nginx.nix
|
||||
./postfix.nix
|
||||
./user.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue