mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-13 05:47:29 +00:00
nixos/mysql: Use notify service type for MySQL >= 8.0
This commit is contained in:
parent
e553e37abf
commit
b445085c22
@ -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";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user