git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/mysql: Cleanups
commit80283570848734d8473b6434141ce8f4406720e7 authorWilliam A. Kennington III <william@wkennington.com> dateTue 31 Mar 2015, 16:16 (12 years ago) parentb74833b
1 file changed+9−5
nixos/modules/services/databases/mysql.nix+9−5
nixos/modules/services/databases/mysql.nix+9−5
@@ -8,7 +8,7 @@ let
88
99 mysql = cfg.package;
1010
11− is55 = mysql.mysqlVersion == "5.5";
11+ atLeast55 = versionAtLeast mysql.mysqlVersion "5.5";
1212
1313 pidFile = "${cfg.pidDir}/mysqld.pid";
1414
@@ -22,7 +22,7 @@ let
2222 port = ${toString cfg.port}
2323 ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
2424 ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
25− ${optionalString (cfg.replication.role == "slave" && !is55)
25+ ${optionalString (cfg.replication.role == "slave" && !atLeast55)
2626 ''
2727 master-host = ${cfg.replication.masterHost}
2828 master-user = ${cfg.replication.masterUser}
@@ -73,7 +73,7 @@ in
7373 };
7474
7575 pidDir = mkOption {
76− default = "/var/run/mysql";
76+ default = "/run/mysqld";
7777 description = "Location of the file which stores the PID of the MySQL server";
7878 };
7979
@@ -178,6 +178,10 @@ in
178178
179179 mkdir -m 0700 -p ${cfg.pidDir}
180180 chown -R ${cfg.user} ${cfg.pidDir}
181+
182+ # Make the socket directory
183+ mkdir -m 0700 -p /run/mysqld
184+ chown -R ${cfg.user} /run/mysqld
181185 '';
182186
183187 serviceConfig.ExecStart = "${mysql}/bin/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
@@ -186,7 +190,7 @@ in
186190 ''
187191 # Wait until the MySQL server is available for use
188192 count=0
189− while [ ! -e /tmp/mysql.sock ]
193+ while [ ! -e /run/mysqld/mysqld.sock ]
190194 do
191195 if [ $count -eq 30 ]
192196 then
@@ -220,7 +224,7 @@ in
220224 fi
221225 '') cfg.initialDatabases}
222226
223− ${optionalString (cfg.replication.role == "slave" && is55)
227+ ${optionalString (cfg.replication.role == "slave" && atLeast55)
224228 ''
225229 # Set up the replication master
226230