about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJosh Hoffer <jhoffer@sansorgan.es>2024-02-11 14:57:32 -0800
committerJosh Hoffer <jhoffer@sansorgan.es>2024-02-11 15:41:25 -0800
commitb445085c22189a9807fbbdd260107e4b37226241 (patch)
tree606615143a1cfbfc60dbb1a6b57e82993d914d8d /nixos
parente553e37abfb7e7fbd280c0b02d43ecd4331fe3c5 (diff)
downloadnixlib-b445085c22189a9807fbbdd260107e4b37226241.tar
nixlib-b445085c22189a9807fbbdd260107e4b37226241.tar.gz
nixlib-b445085c22189a9807fbbdd260107e4b37226241.tar.bz2
nixlib-b445085c22189a9807fbbdd260107e4b37226241.tar.lz
nixlib-b445085c22189a9807fbbdd260107e4b37226241.tar.xz
nixlib-b445085c22189a9807fbbdd260107e4b37226241.tar.zst
nixlib-b445085c22189a9807fbbdd260107e4b37226241.zip
nixos/mysql: Use notify service type for MySQL >= 8.0
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/databases/mysql.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 788a4bd43c68..a6d71cca88de 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -7,6 +7,9 @@ let
   cfg = config.services.mysql;
 
   isMariaDB = lib.getName cfg.package == lib.getName pkgs.mariadb;
+  isOracle = lib.getName cfg.package == lib.getName pkgs.mysql80;
+  # Oracle MySQL has supported "notify" service type since 8.0
+  hasNotify = isMariaDB || (isOracle && versionAtLeast cfg.package.version "8.0");
 
   mysqldOptions =
     "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${cfg.package}";
@@ -377,7 +380,7 @@ in
         # The super user account to use on *first* run of MySQL server
         superUser = if isMariaDB then cfg.user else "root";
       in ''
-        ${optionalString (!isMariaDB) ''
+        ${optionalString (!hasNotify) ''
           # Wait until the MySQL server is available for use
           while [ ! -e /run/mysqld/mysqld.sock ]
           do
@@ -469,7 +472,7 @@ in
 
       serviceConfig = mkMerge [
         {
-          Type = if isMariaDB then "notify" else "simple";
+          Type = if hasNotify then "notify" else "simple";
           Restart = "on-abort";
           RestartSec = "5s";