mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
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.
This commit is contained in:
parent
8093c136a2
commit
86b48684bb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user