mailserver.nix (817B)
1 { 2 config, 3 lib, 4 ... 5 }: 6 7 let 8 cfg = config.services.local.mailserver; 9 in 10 { 11 options.services.local.mailserver = { 12 enable = lib.mkEnableOption "Mail server"; 13 14 fqdn = lib.mkOption { 15 type = lib.types.str; 16 description = "Fully qualified domain name of the mail server"; 17 }; 18 19 domains = lib.mkOption { 20 type = lib.types.listOf lib.types.str; 21 description = "Domains to receive mail for"; 22 }; 23 24 accounts = lib.mkOption { 25 type = lib.types.attrs; 26 default = { }; 27 description = "Mail accounts configuration"; 28 }; 29 }; 30 31 config = lib.mkIf cfg.enable { 32 mailserver = { 33 enable = true; 34 stateVersion = 5; 35 fqdn = cfg.fqdn; 36 domains = cfg.domains; 37 certificateScheme = "acme-nginx"; 38 loginAccounts = cfg.accounts; 39 }; 40 }; 41 }