anchor.diff:          description = "Location where MySQL stores its table files";
         };
   
  +      configFile = mkOption {
  +        type = types.path;
  +        default = settingsFile;
  +        defaultText = "settingsFile";
  +        description = ''
  +          Override the configuration file used by MySQL. By default,
  +          NixOS generates one automatically from <option>services.mysql.settings</option>.
  +        '';
  +        example = literalExample ''
  +          pkgs.writeText "my.cnf" '''
  +            [mysqld]
  +            datadir = /var/lib/mysql
  +            bind-address = 127.0.0.1
  +            port = 3336
  +            plugin-load-add = auth_socket.so
  +
  +            !includedir /etc/mysql/conf.d/
  +          ''';
  +        '';
  +      };
  +
  +      settings = mkOption {
  +        type = with types; attrsOf (attrsOf (oneOf [ bool int str (listOf str) ]));
  +        default = {};
  +        description = ''
  +          MySQL configuration. Refer to
  +          <link xlink:href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html"/>,
  +          <link xlink:href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html"/>,
  +          and <link xlink:href="https://mariadb.com/kb/en/server-system-variables/"/>
  +          for details on supported values.
  +
  +          <note>
  +            <para>
  +              MySQL configuration options such as <literal>--quick</literal> should be treated as
  +              boolean options and provided values such as <literal>true</literal>, <literal>false</literal>,
  +              <literal>1</literal>, or <literal>0</literal>. See the provided example below.
  +            </para>
  +          </note>
  +        '';
  +        example = literalExample ''
  +          {
  +            mysqld = {
  +              key_buffer_size = "6G";
  +              table_cache = 1600;
  +              log-error = "/var/log/mysql_err.log";
  +              plugin-load-add = [ "server_audit" "ed25519=auth_ed25519" ];
  +            };
  +            mysqldump = {
  +              quick = true;
  +              max_allowed_packet = "16M";
  +            };
  +          }
  +        '';
  +      };
  +
         extraOptions = mkOption {
  -        type = types.lines;
  -        default = "";
  +        type = with types; nullOr lines;
  +        default = null;
           example = ''
             key_buffer_size = 6G
             table_cache = 1600
  
positive.code: 
    config = mkIf config.services.mysql.enable {
  
      services.mysql.dataDir =
        mkDefault (if versionAtLeast config.system.stateVersion "17.09" then "/var/lib/mysql"
                   else "/var/mysql");
  
      users.users.mysql = {
        description = "MySQL server user";
  
negative.code:   installOptions =
      "${mysqldOptions} ${lib.optionalString isMysqlAtLeast57 "--insecure"}";
  
    settingsFile = pkgs.writeText "my.cnf" (
      generators.toINI { listsAsDuplicateKeys = true; } cfg.settings +
      optionalString (cfg.extraOptions != null) "[mysqld]\n${cfg.extraOptions}"
    );
  
  in
  
  {
  