blob: 07c628ae2cadf2897411c029352e43e349692852 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.go-autoconfig;
format = pkgs.formats.yaml { };
configFile = format.generate "config.yml" cfg.settings;
in {
options = {
services.go-autoconfig = {
enable = mkEnableOption (mdDoc "IMAP/SMTP autodiscover feature for mail clients");
settings = mkOption {
default = { };
description = mdDoc ''
Configuration for go-autoconfig. See
<https://github.com/L11R/go-autoconfig/blob/master/config.yml>
for more information.
'';
type = types.submodule {
freeformType = format.type;
};
example = literalExpression ''
{
service_addr = ":1323";
domain = "autoconfig.example.org";
imap = {
server = "example.org";
port = 993;
};
smtp = {
server = "example.org";
port = 465;
};
}
'';
};
};
};
config = mkIf cfg.enable {
systemd = {
services.go-autoconfig = {
wantedBy = [ "multi-user.target" ];
description = "IMAP/SMTP autodiscover server";
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${pkgs.go-autoconfig}/bin/go-autoconfig -config ${configFile}";
Restart = "on-failure";
WorkingDirectory = ''${pkgs.go-autoconfig}/'';
DynamicUser = true;
};
};
};
};
meta.maintainers = with lib.maintainers; [ onny ];
}
|