···77 cfg = config.services.mysql;
8899 isMariaDB = lib.getName cfg.package == lib.getName pkgs.mariadb;
1010+ isOracle = lib.getName cfg.package == lib.getName pkgs.mysql80;
1111+ # Oracle MySQL has supported "notify" service type since 8.0
1212+ hasNotify = isMariaDB || (isOracle && versionAtLeast cfg.package.version "8.0");
10131114 mysqldOptions =
1215 "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${cfg.package}";
···377380 # The super user account to use on *first* run of MySQL server
378381 superUser = if isMariaDB then cfg.user else "root";
379382 in ''
380380- ${optionalString (!isMariaDB) ''
383383+ ${optionalString (!hasNotify) ''
381384 # Wait until the MySQL server is available for use
382382- count=0
383385 while [ ! -e /run/mysqld/mysqld.sock ]
384386 do
385385- if [ $count -eq 30 ]
386386- then
387387- echo "Tried 30 times, giving up..."
388388- exit 1
389389- fi
390390-391387 echo "MySQL daemon not yet started. Waiting for 1 second..."
392392- count=$((count++))
393388 sleep 1
394389 done
395390 ''}
···477472478473 serviceConfig = mkMerge [
479474 {
480480- Type = if isMariaDB then "notify" else "simple";
475475+ Type = if hasNotify then "notify" else "simple";
481476 Restart = "on-abort";
482477 RestartSec = "5s";
483478