1 { config, lib, pkgs, ... }:
7 cfg = config.services.go-autoconfig;
8 format = pkgs.formats.yaml { };
9 configFile = format.generate "config.yml" cfg.settings;
13 services.go-autoconfig = {
15 enable = mkEnableOption (mdDoc "IMAP/SMTP autodiscover feature for mail clients");
19 description = mdDoc ''
20 Configuration for go-autoconfig. See
21 <https://github.com/L11R/go-autoconfig/blob/master/config.yml>
24 type = types.submodule {
25 freeformType = format.type;
27 example = literalExpression ''
29 service_addr = ":1323";
30 domain = "autoconfig.example.org";
32 server = "example.org";
36 server = "example.org";
46 config = mkIf cfg.enable {
49 services.go-autoconfig = {
50 wantedBy = [ "multi-user.target" ];
51 description = "IMAP/SMTP autodiscover server";
52 after = [ "network.target" ];
54 ExecStart = "${pkgs.go-autoconfig}/bin/go-autoconfig -config ${configFile}";
55 Restart = "on-failure";
56 WorkingDirectory = ''${pkgs.go-autoconfig}/'';
64 meta.maintainers = with lib.maintainers; [ onny ];