From 0bc74963f09dc60aefb151d539402dcf5d2833b0 Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sun, 8 Jan 2023 00:14:02 +0700 Subject: [PATCH 1/4] zoneminder: 1.36.28 -> 1.36.32 --- pkgs/servers/zoneminder/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/zoneminder/default.nix b/pkgs/servers/zoneminder/default.nix index cfdde9ab2d87..80ff140122fd 100644 --- a/pkgs/servers/zoneminder/default.nix +++ b/pkgs/servers/zoneminder/default.nix @@ -57,13 +57,13 @@ let in stdenv.mkDerivation rec { pname = "zoneminder"; - version = "1.36.28"; + version = "1.36.32"; src = fetchFromGitHub { owner = "ZoneMinder"; repo = "zoneminder"; rev = version; - sha256 = "sha256-x00u7AWMNS+wAO/tdWi7GYbMZZM7XnszCO57ZDlm0J0="; + sha256 = "sha256-8iRoGpkpZVOOr0wSY9iey2x4gPfKTfUNtt5TCHCCRIQ="; fetchSubmodules = true; }; From 4c64355fa3f48800ec36ef0b8c41dd5bcb895d6e Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sat, 5 Nov 2022 15:48:03 +0700 Subject: [PATCH 2/4] nixos/zoneminder: also run zmupdate "freshen" on start -f "freshen the configuration in the database", which will matter when ZoneMinder adds a new configuration item [1]. Although it can also be run without a new configuration item too; upstream's Debian postinst code always run it on upgrade [2]. [1] e.g. https://forums.zoneminder.com/viewtopic.php?p=127220 [2] https://github.com/ZoneMinder/zoneminder/blob/master/distros/ubuntu2004/zoneminder.postinst#L45 --- nixos/modules/services/misc/zoneminder.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/misc/zoneminder.nix b/nixos/modules/services/misc/zoneminder.nix index 109415a20ee6..a52428ca1f67 100644 --- a/nixos/modules/services/misc/zoneminder.nix +++ b/nixos/modules/services/misc/zoneminder.nix @@ -326,6 +326,7 @@ in { fi ${zoneminder}/bin/zmupdate.pl -nointeractive + ${zoneminder}/bin/zmupdate.pl --nointeractive -f ''; serviceConfig = { User = user; From 8093c136a2fadb81a6bc629a33827ed4c39ed55e Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sat, 5 Nov 2022 15:56:09 +0700 Subject: [PATCH 3/4] nixos/zoneminder: requires `sysvsem` PHP extension This is used in ZoneMinder since some time ago [1]. Without this extension, controling of playback (play, pause, fast forward, etc.) will not work. [1] https://github.com/ZoneMinder/zoneminder/issues/2261#issuecomment-433129559 --- nixos/modules/services/misc/zoneminder.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/zoneminder.nix b/nixos/modules/services/misc/zoneminder.nix index a52428ca1f67..45b554d193d5 100644 --- a/nixos/modules/services/misc/zoneminder.nix +++ b/nixos/modules/services/misc/zoneminder.nix @@ -283,7 +283,8 @@ in { phpfpm = lib.mkIf useNginx { pools.zoneminder = { inherit user group; - phpPackage = pkgs.php.withExtensions ({ enabled, all }: enabled ++ [ all.apcu ]); + phpPackage = pkgs.php.withExtensions ( + { enabled, all }: enabled ++ [ all.apcu all.sysvsem ]); phpOptions = '' date.timezone = "${config.time.timeZone}" ''; From 86b48684bb028e551bf6c876d0a0668532ea2f4f Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sat, 5 Nov 2022 16:51:30 +0700 Subject: [PATCH 4/4] nixos/zoneminder: automatically update Nix store path in config DB ZM has a configuration which defaults to a file in its installaton path. In NixOS, this means a Nix store path is persisted into the database, which will break when e.g. ZM is upgraded. Workaround this by doing a regular expression-based string replacement SQL command to replace this value. The regular expression should not match if users has changed this config to somewhere else. It will match even if ZM isn't upgraded, in which case it'll replace the value with itself. As such, it should be safe to run this at every ZM startup. --- nixos/modules/services/misc/zoneminder.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/modules/services/misc/zoneminder.nix b/nixos/modules/services/misc/zoneminder.nix index 45b554d193d5..11722979851c 100644 --- a/nixos/modules/services/misc/zoneminder.nix +++ b/nixos/modules/services/misc/zoneminder.nix @@ -328,6 +328,14 @@ in { ${zoneminder}/bin/zmupdate.pl -nointeractive ${zoneminder}/bin/zmupdate.pl --nointeractive -f + + # Update ZM's Nix store path in the configuration table. Do nothing if the config doesn't + # contain ZM's Nix store path. + ${config.services.mysql.package}/bin/mysql -u zoneminder zm << EOF + UPDATE Config + SET Value = REGEXP_REPLACE(Value, "^/nix/store/[^-/]+-zoneminder-[^/]+", "${pkgs.zoneminder}") + WHERE Name = "ZM_FONT_FILE_LOCATION"; + EOF ''; serviceConfig = { User = user;