mysql module: fix flaky check
Comparing packages via equality will lead to different results when package and module are from different `nixpkgs` checkouts. Also, because MariaDB is actually supported, added a note to option description to make this knowledge more discover-able.
This commit is contained in:
parent
462b5e0d21
commit
9f7315caf2
@ -8,6 +8,11 @@ let
|
|||||||
|
|
||||||
mysql = cfg.package;
|
mysql = cfg.package;
|
||||||
|
|
||||||
|
isMariaDB =
|
||||||
|
let
|
||||||
|
pName = _p: (builtins.parseDrvName (_p.name)).name;
|
||||||
|
in pName mysql == pName pkgs.mariadb;
|
||||||
|
|
||||||
atLeast55 = versionAtLeast mysql.mysqlVersion "5.5";
|
atLeast55 = versionAtLeast mysql.mysqlVersion "5.5";
|
||||||
|
|
||||||
pidFile = "${cfg.pidDir}/mysqld.pid";
|
pidFile = "${cfg.pidDir}/mysqld.pid";
|
||||||
@ -59,7 +64,7 @@ in
|
|||||||
type = types.package;
|
type = types.package;
|
||||||
example = literalExample "pkgs.mysql";
|
example = literalExample "pkgs.mysql";
|
||||||
description = "
|
description = "
|
||||||
Which MySQL derivation to use.
|
Which MySQL derivation to use. MariaDB packages are supported too.
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -360,7 +365,7 @@ in
|
|||||||
|
|
||||||
${concatMapStrings (user:
|
${concatMapStrings (user:
|
||||||
''
|
''
|
||||||
( echo "CREATE USER IF NOT EXISTS '${user.name}'@'localhost' IDENTIFIED WITH ${if mysql == pkgs.mariadb then "unix_socket" else "auth_socket"};"
|
( echo "CREATE USER IF NOT EXISTS '${user.name}'@'localhost' IDENTIFIED WITH ${if isMariaDB then "unix_socket" else "auth_socket"};"
|
||||||
${concatStringsSep "\n" (mapAttrsToList (database: permission: ''
|
${concatStringsSep "\n" (mapAttrsToList (database: permission: ''
|
||||||
echo "GRANT ${permission} ON ${database} TO '${user.name}'@'localhost';"
|
echo "GRANT ${permission} ON ${database} TO '${user.name}'@'localhost';"
|
||||||
'') user.ensurePermissions)}
|
'') user.ensurePermissions)}
|
||||||
|
Loading…
Reference in New Issue
Block a user