Skip to content

Commit

Permalink
Fix regression when Mysql user password is not set
Browse files Browse the repository at this point in the history
The error was:

       … while calling anonymous lambda

         at /nix/store/s0nrb80miw28kw7ni6ia05fk5ckmyiaw-source/src/modules/services/mysql.nix:114:25:

          113|
          114|     ${concatMapStrings (user: ''
             |                         ^
          115|         echo "Adding user: ${user.name}"

       error: cannot coerce null to a string
  • Loading branch information
amiryal committed Jan 2, 2025
1 parent 1cd2afa commit 23724ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/services/mysql.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ with lib; let
echo "Adding user: ${user.name}"
${optionalString (user.password != null) "password='${user.password}'"}
(
if [ "${user.name}" = "root" ] && [ -n ${user.password} ]; then
if [ "${user.name}" = "root" ] && [ -n "$password" ]; then
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password';"
else
echo "CREATE USER IF NOT EXISTS '${user.name}'@'localhost' ${optionalString (user.password != null) "IDENTIFIED BY '$password'"};"
Expand Down

0 comments on commit 23724ef

Please sign in to comment.