anchor.diff:            The database engine name. Can be sqlite or psycopg2.
           '';
         };
  +      create_local_database = mkOption {
  +        type = types.bool;
  +        default = true;
  +        description = ''
  +          Whether to create a local database automatically.
  +        '';
  +      };
  +      database_name = mkOption {
  +        type = types.str;
  +        default = "matrix-synapse";
  +        description = "Database name.";
  +      };
  +      database_user = mkOption {
  +        type = types.str;
  +        default = "matrix-synapse";
  +        description = "Database user name.";
  +      };
         database_args = mkOption {
           type = types.attrs;
           default = {
  -          database = "${cfg.dataDir}/homeserver.db";
  -        };
  +          sqlite3 = { database = "${cfg.dataDir}/homeserver.db"; };
  +          psycopg2 = {
  +            user = cfg.database_user;
  +            database = cfg.database_name;
  +          };
  +        }."${cfg.database_type}";
           description = ''
             Arguments to pass to the engine.
           '';
  
positive.code:         gid = config.ids.gids.matrix-synapse;
        } ];
  
      systemd.services.matrix-synapse = {
        description = "Synapse Matrix homeserver";
        after = [ "network.target" ];
        wantedBy = [ "multi-user.target" ];
        preStart = ''
          ${cfg.package}/bin/homeserver \
            --config-path ${configFile} \
            --keys-directory ${cfg.dataDir} \
            --generate-keys
        '';
        serviceConfig = {
          Type = "simple";
  
negative.code:       tls_private_key_path = mkOption {
          type = types.nullOr types.str;
          default = null;
          example = "${cfg.dataDir}/homeserver.tls.key";
          description = ''
            PEM encoded private key for TLS. Specify null if synapse is not
            speaking TLS directly.
  