summary refs log tree commit diff
path: root/nixos/modules/services/databases
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2021-12-18 21:00:04 -0500
committerAaron Andersen <aaron@fosslib.net>2021-12-18 21:01:48 -0500
commit76457da532300330b5b9c74d5d312e72ce2c90b3 (patch)
tree7ec15170bec120f9f7b3762b1049abc769d2d9f3 /nixos/modules/services/databases
parentf1d1d319ae3dc8e373aabe71bc90cf7fd252fe69 (diff)
downloadnixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar.gz
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar.bz2
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar.lz
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar.xz
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.tar.zst
nixpkgs-76457da532300330b5b9c74d5d312e72ce2c90b3.zip
nixos/mysql: remove services.mysql.extraOptions in favor of services.mysql.settings
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r--nixos/modules/services/databases/mysql.nix34
1 files changed, 8 insertions, 26 deletions
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 4c77efa4bff..1f32f1d0f5d 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -11,10 +11,8 @@ let
   mysqldOptions =
     "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${cfg.package}";
 
-  settingsFile = pkgs.writeText "my.cnf" (
-    generators.toINI { listsAsDuplicateKeys = true; } cfg.settings +
-    optionalString (cfg.extraOptions != null) "[mysqld]\n${cfg.extraOptions}"
-  );
+  format = pkgs.formats.ini { listsAsDuplicateKeys = true; };
+  configFile = format.generate "my.cnf" cfg.settings;
 
 in
 
@@ -22,6 +20,7 @@ in
   imports = [
     (mkRemovedOptionModule [ "services" "mysql" "pidDir" ] "Don't wait for pidfiles, describe dependencies through systemd.")
     (mkRemovedOptionModule [ "services" "mysql" "rootPassword" ] "Use socket authentication or set the password outside of the nix store.")
+    (mkRemovedOptionModule [ "services" "mysql" "extraOptions" ] "Use services.mysql.settings.mysqld instead.")
   ];
 
   ###### interface
@@ -96,8 +95,10 @@ in
 
       configFile = mkOption {
         type = types.path;
-        default = settingsFile;
-        defaultText = literalExpression "settingsFile";
+        default = configFile;
+        defaultText = ''
+          A configuration file automatically generated by NixOS.
+        '';
         description = ''
           Override the configuration file used by MySQL. By default,
           NixOS generates one automatically from <option>services.mysql.settings</option>.
@@ -115,7 +116,7 @@ in
       };
 
       settings = mkOption {
-        type = with types; attrsOf (attrsOf (oneOf [ bool int str (listOf str) ]));
+        type = format.type;
         default = {};
         description = ''
           MySQL configuration. Refer to
@@ -148,23 +149,6 @@ in
         '';
       };
 
-      extraOptions = mkOption {
-        type = with types; nullOr lines;
-        default = null;
-        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
-          <literal>[mysqld]</literal> section so you don't need to explicitly
-          state it again.
-        '';
-      };
-
       initialDatabases = mkOption {
         type = types.listOf (types.submodule {
           options = {
@@ -324,8 +308,6 @@ in
 
   config = mkIf config.services.mysql.enable {
 
-    warnings = optional (cfg.extraOptions != null) "services.mysql.`extraOptions` is deprecated, please use services.mysql.`settings`.";
-
     services.mysql.dataDir =
       mkDefault (if versionAtLeast config.system.stateVersion "17.09" then "/var/lib/mysql"
                  else "/var/mysql");