9 cfg = config.services.go-autoconfig;
10 format = pkgs.formats.yaml { };
11 configFile = format.generate "config.yml" cfg.settings;
16 services.go-autoconfig = {
18 enable = lib.mkEnableOption "IMAP/SMTP autodiscover feature for mail clients";
20 settings = lib.mkOption {
23 Configuration for go-autoconfig. See
24 <https://github.com/L11R/go-autoconfig/blob/master/config.yml>
27 type = lib.types.submodule {
28 freeformType = format.type;
30 example = lib.literalExpression ''
32 service_addr = ":1323";
33 domain = "autoconfig.example.org";
35 server = "example.org";
39 server = "example.org";
49 config = lib.mkIf cfg.enable {
52 services.go-autoconfig = {
53 wantedBy = [ "multi-user.target" ];
54 description = "IMAP/SMTP autodiscover server";
55 after = [ "network.target" ];
57 ExecStart = "${pkgs.go-autoconfig}/bin/go-autoconfig -config ${configFile}";
58 Restart = "on-failure";
59 WorkingDirectory = ''${pkgs.go-autoconfig}/'';
67 meta.maintainers = with lib.maintainers; [ onny ];