86 lines
2 KiB
Nix
86 lines
2 KiB
Nix
|
{ config, lib, ... }:
|
||
|
with lib;
|
||
|
let cfg = config.mailserver;
|
||
|
in {
|
||
|
options.mailserver = {
|
||
|
enable = mkEnableOption "mailserver";
|
||
|
|
||
|
fqdn = mkOption { type = types.str; };
|
||
|
|
||
|
domains = mkOption { type = types.listOf types.str; };
|
||
|
|
||
|
ssl_config = mkOption {
|
||
|
type = (types.submodule {
|
||
|
options = {
|
||
|
useACME = mkOption {
|
||
|
type = types.bool;
|
||
|
default = true;
|
||
|
};
|
||
|
cert = mkOption {
|
||
|
type = types.str;
|
||
|
default = "/var/lib/acme/${cfg.fqdn}/fullchain.pem";
|
||
|
};
|
||
|
key = mkOption {
|
||
|
type = types.str;
|
||
|
default = "/var/lib/acme/${cfg.fqdn}/key.pem";
|
||
|
};
|
||
|
};
|
||
|
});
|
||
|
default = { };
|
||
|
};
|
||
|
debug_mode = mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
};
|
||
|
|
||
|
accounts = mkOption {
|
||
|
# where name = email for login
|
||
|
type = types.attrsOf (types.submodule ({ config, name, ... }: {
|
||
|
options = {
|
||
|
name = mkOption {
|
||
|
type = types.str;
|
||
|
default = name;
|
||
|
};
|
||
|
passwordFile = mkOption { type = types.str; };
|
||
|
aliases = mkOption { type = types.listOf types.str; };
|
||
|
sieveScript = mkOption { type = types.nullOr types.lines; };
|
||
|
};
|
||
|
}));
|
||
|
};
|
||
|
|
||
|
sieve_directory = mkOption {
|
||
|
type = types.str;
|
||
|
default = "/var/sieve";
|
||
|
};
|
||
|
dkim_directory = mkOption {
|
||
|
type = types.str;
|
||
|
default = "/var/dkim";
|
||
|
};
|
||
|
|
||
|
policyd_config = mkOption {
|
||
|
type = types.lines;
|
||
|
default = "";
|
||
|
};
|
||
|
|
||
|
vmail_config = mkOption {
|
||
|
type = (types.submodule {
|
||
|
options = {
|
||
|
user_group_name = mkOption {
|
||
|
type = types.str;
|
||
|
default = "vmail";
|
||
|
};
|
||
|
user_group_id = mkOption {
|
||
|
type = types.number;
|
||
|
default = 5000;
|
||
|
};
|
||
|
directory = mkOption {
|
||
|
type = types.str;
|
||
|
default = "/home/${cfg.vmail_config.user_group_name}";
|
||
|
};
|
||
|
};
|
||
|
});
|
||
|
default = {};
|
||
|
};
|
||
|
};
|
||
|
}
|