diff --git a/modules/services/databases/mysql.nix b/modules/services/databases/mysql.nix index 7bf7a77aa85..ed9d03dc60f 100644 --- a/modules/services/databases/mysql.nix +++ b/modules/services/databases/mysql.nix @@ -12,7 +12,7 @@ let mysqldOptions = "--user=${cfg.user} --datadir=${cfg.dataDir} " + - "--log-error=${cfg.logError} --pid-file=${pidFile}"; + "--pid-file=${pidFile}"; myCnf = pkgs.writeText "my.cnf" '' @@ -26,6 +26,7 @@ let master-password = ${cfg.replication.masterPassword} master-port = ${toString cfg.replication.masterPort} ''} + ${cfg.extraOptions} ''; in @@ -67,16 +68,27 @@ in description = "Location where MySQL stores its table files"; }; - logError = mkOption { - default = "/var/log/mysql_err.log"; - description = "Location of the MySQL error logfile"; - }; - pidDir = mkOption { default = "/var/run/mysql"; description = "Location of the file which stores the PID of the MySQL server"; }; + extraOptions = mkOption { + default = ""; + example = '' + key_buffer_size = 6G + table_cache = 1600 + log-error = /var/log/mysql_err.log + ''; + description = '' + Provide extra options to the MySQL configuration file. + + Please note, that these options are added to the + [mysqld] section so you don't need to explicitly + state it again. + ''; + }; + initialDatabases = mkOption { default = []; description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL"; diff --git a/modules/services/databases/mysql55.nix b/modules/services/databases/mysql55.nix index 37cab395677..1da182a0e59 100644 --- a/modules/services/databases/mysql55.nix +++ b/modules/services/databases/mysql55.nix @@ -12,13 +12,14 @@ let mysqldOptions = "--user=${cfg.user} --datadir=${cfg.dataDir} " + - "--log-error=${cfg.logError} --pid-file=${pidFile}"; + "--pid-file=${pidFile}"; myCnf = pkgs.writeText "my.cnf" '' [mysqld] ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"} ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"} + ${cfg.extraOptions} ''; in @@ -60,16 +61,27 @@ in description = "Location where MySQL stores its table files"; }; - logError = mkOption { - default = "/var/log/mysql_err.log"; - description = "Location of the MySQL error logfile"; - }; - pidDir = mkOption { default = "/var/run/mysql"; description = "Location of the file which stores the PID of the MySQL server"; }; + extraOptions = mkOption { + default = ""; + example = '' + key_buffer_size = 6G + table_cache = 1600 + log-error = /var/log/mysql_err.log + ''; + description = '' + Provide extra options to the MySQL configuration file. + + Please note, that these options are added to the + [mysqld] section so you don't need to explicitly + state it again. + ''; + }; + initialDatabases = mkOption { default = []; description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";