Skip to content

Commit

Permalink
Merge pull request #1067 from cachix/mysql-socket
Browse files Browse the repository at this point in the history
Fix #1054
  • Loading branch information
domenkozar authored Apr 1, 2024
2 parents 1909832 + 971f491 commit 76e2f35
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/modules/services/mysql.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ with lib; let
configureTimezones = ''
# Start a temp database with the default-time-zone to import tz data
# and hide the temp database from the configureScript by setting a custom socket
nohup ${cfg.package}/bin/mysqld ${mysqldOptions} --socket="$MYSQL_HOME/config.sock" --skip-networking --default-time-zone=SYSTEM &
nohup ${cfg.package}/bin/mysqld ${mysqldOptions} --socket="$DEVENV_RUNTIME/config.sock" --skip-networking --default-time-zone=SYSTEM &
while ! MYSQL_PWD="" ${mysqladminWrappedEmpty}/bin/mysqladmin --socket="$MYSQL_HOME/config.sock" ping -u root --silent; do
while ! MYSQL_PWD="" ${mysqladminWrappedEmpty}/bin/mysqladmin --socket="$DEVENV_RUNTIME/config.sock" ping -u root --silent; do
sleep 1
done
${cfg.package}/bin/mysql_tzinfo_to_sql ${pkgs.tzdata}/share/zoneinfo/ | MYSQL_PWD="" ${mysqlWrappedEmpty}/bin/mysql --socket="$MYSQL_HOME/config.sock" -u root mysql
${cfg.package}/bin/mysql_tzinfo_to_sql ${pkgs.tzdata}/share/zoneinfo/ | MYSQL_PWD="" ${mysqlWrappedEmpty}/bin/mysql --socket="$DEVENV_RUNTIME/config.sock" -u root mysql
# Shutdown the temp database
MYSQL_PWD="" ${mysqladminWrappedEmpty}/bin/mysqladmin --socket="$MYSQL_HOME/config.sock" shutdown -u root
MYSQL_PWD="" ${mysqladminWrappedEmpty}/bin/mysqladmin --socket="$DEVENV_RUNTIME/config.sock" shutdown -u root
'';

startScript = pkgs.writeShellScriptBin "start-mysql" ''
Expand Down Expand Up @@ -286,8 +286,8 @@ in
env =
{
MYSQL_HOME = config.env.DEVENV_STATE + "/mysql";
MYSQL_UNIX_PORT = config.env.DEVENV_STATE + "/mysql.sock";
MYSQLX_UNIX_PORT = config.env.DEVENV_STATE + "/mysqlx.sock";
MYSQL_UNIX_PORT = config.env.DEVENV_RUNTIME + "/mysql.sock";
MYSQLX_UNIX_PORT = config.env.DEVENV_RUNTIME + "/mysqlx.sock";
}
// (optionalAttrs (hasAttrByPath [ "mysqld" "port" ] cfg.settings) {
MYSQL_TCP_PORT = toString cfg.settings.mysqld.port;
Expand Down

0 comments on commit 76e2f35

Please sign in to comment.