1 { config, lib, pkgs, ... }:
4 cfg = config.services.go-autoconfig;
5 format = pkgs.formats.yaml { };
6 configFile = format.generate "config.yml" cfg.settings;
10 services.go-autoconfig = {
12 enable = lib.mkEnableOption "IMAP/SMTP autodiscover feature for mail clients";
14 settings = lib.mkOption {
17 Configuration for go-autoconfig. See
18 <https://github.com/L11R/go-autoconfig/blob/master/config.yml>
21 type = lib.types.submodule {
22 freeformType = format.type;
24 example = lib.literalExpression ''
26 service_addr = ":1323";
27 domain = "autoconfig.example.org";
29 server = "example.org";
33 server = "example.org";
43 config = lib.mkIf cfg.enable {
46 services.go-autoconfig = {
47 wantedBy = [ "multi-user.target" ];
48 description = "IMAP/SMTP autodiscover server";
49 after = [ "network.target" ];
51 ExecStart = "${pkgs.go-autoconfig}/bin/go-autoconfig -config ${configFile}";
52 Restart = "on-failure";
53 WorkingDirectory = ''${pkgs.go-autoconfig}/'';
61 meta.maintainers = with lib.maintainers; [ onny ];