anchor.diff:      paths = attrValues cfg.modules;
     };
   
  -  configFile = pkgs.writeText "zabbix_server.conf" ''
  -    LogType = console
  -    ListenIP = ${cfg.listen.ip}
  -    ListenPort = ${toString cfg.listen.port}
  -    # TODO: set to cfg.database.socket if database type is pgsql?
  -    DBHost = ${optionalString (cfg.database.createLocally != true) cfg.database.host}
  -    ${optionalString (cfg.database.createLocally != true) "DBPort = ${cfg.database.port}"}
  -    DBName = ${cfg.database.name}
  -    DBUser = ${cfg.database.user}
  -    ${optionalString (cfg.database.passwordFile != null) "Include ${passwordFile}"}
  -    ${optionalString (mysqlLocal && cfg.database.socket != null) "DBSocket = ${cfg.database.socket}"}
  -    PidFile = ${runtimeDir}/zabbix_server.pid
  -    SocketDir = ${runtimeDir}
  -    FpingLocation = /run/wrappers/bin/fping
  -    ${optionalString (cfg.modules != {}) "LoadModulePath = ${moduleEnv}/lib"}
  -    ${concatMapStringsSep "\n" (name: "LoadModule = ${name}") (builtins.attrNames cfg.modules)}
  -    ${cfg.extraConfig}
  -  '';
  +  configFile = pkgs.writeText "zabbix_server.conf" (toKeyValue { listsAsDuplicateKeys = true; } cfg.settings);
   
     mysqlLocal = cfg.database.createLocally && cfg.database.type == "mysql";
     pgsqlLocal = cfg.database.createLocally && cfg.database.type == "pgsql";
  
positive.code:       { assertion = cfg.database.createLocally -> cfg.database.passwordFile == null;
          message = "a password cannot be specified if services.zabbixServer.database.createLocally is set to true";
        }
      ];
  
      networking.firewall = mkIf cfg.openFirewall {
  
negative.code:         '';
        };
  
        settings = mkOption {
          type = with types; attrsOf (oneOf [ int str (listOf str) ]);
          default = {};
          description = ''
            Zabbix Server configuration. Refer to
            <link xlink:href="https://www.zabbix.com/documentation/current/manual/appendix/config/zabbix_server"/>
            for details on supported values.
          '';
          example = {
            CacheSize = "1G";
            SSHKeyLocation = "/var/lib/zabbix/.ssh";
            StartPingers = 32;
          };
        };
  
      };
  