git.iko.soy/typeable/nixpkgs
on master help sign in
Fix locally created database (#56889)

* zoneminder: fix initial database creation Move initialDatabases directive from the 'ensureUsers' scope to the correct outer 'mysql' one. * zoneminder: Fix mysql username to match unix username When database.createLocally is used, a mysql user is created with the ensureUsers directive. It ensures that the unix user with the name provided exists and can connect to MySQL through socket. Thus, the MySQL username used by php/perl scripts must match the unix user owning the server PID. This patch sets the default mysql user to 'zoneminder' instead of 'zmuser'.

commitd7f6cdeda4ea942b556677e1a590edd203c0c646 authorAlexandre Mazari <alexandre.mazari@gmail.com> dateSat 9 Mar 2019, 16:57 (8 years ago) parent32e9296
1 file changed+4−4
nixos/modules/services/misc/zoneminder.nix+4−4
nixos/modules/services/misc/zoneminder.nix+4−4
@@ -49,7 +49,7 @@ let
4949 # Database
5050 ZM_DB_TYPE=mysql
5151 ZM_DB_HOST=${cfg.database.host}
52− ZM_DB_NAME=${cfg.database.name}
52+ ZM_DB_NAME=${if cfg.database.createLocally then user else cfg.database.username}
5353 ZM_DB_USER=${cfg.database.username}
5454 ZM_DB_PASS=${cfg.database.password}
5555
@@ -205,12 +205,12 @@ in {
205205
206206 mysql = lib.mkIf cfg.database.createLocally {
207207 ensureDatabases = [ cfg.database.name ];
208+ initialDatabases = [{
209+ inherit (cfg.database) name; schema = "${pkg}/share/zoneminder/db/zm_create.sql";
210+ }];
208211 ensureUsers = [{
209212 name = cfg.database.username;
210213 ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; };
211− initialDatabases = [
212− { inherit (cfg.database) name; schema = "${pkg}/share/zoneminder/db/zm_create.sql"; }
213− ];
214214 }];
215215 };
216216