Zoneminder

From NixOS Wiki
Jump to: navigation, search

Initial working version of Zoneminder.

Note, I added this because I could not find a template elsewhere. This has not been thoroughly tested beyond a proof of life on my own machine. YMMV!

{ pkgs, ... }:{
  services.zoneminder = {
    enable = true;
    openFirewall = true;
    port = 8095; # standard, but explicit
    cameras = 10;
    database.username = "zoneminder"; # required by `CreateLocally`
    database.createLocally = true; # automatically initialize the database
    storageDir = "/mnt/arxv/services/zoneminder";
  };

  # Zoneminder by default does not set up a database for you. This assumes you want Zoneminder + the db on one machine.
  services.mysql = {
    enable = true;
    package = pkgs.mariadb;
    settings.mysqld.log_bin_trust_function_creators = 1;
  };
}

Troubleshooting

This is likely just due to me playing around with `services.mysql.package` going between `pkgs.mysql84` and `pkgs.mariadb`, but I had to clear out the database and allow mariadb to reinitialize.

# Stop services
sudo systemctl stop zoneminder
sudo systemctl stop mysql
# ... any other services you might have relying on mysql

# Completely remove the data directory
sudo rm -rf /var/lib/mysql

# Rebuild
# NixOS re-initializes /var/lib/mysql with a fresh MariaDB automatically
sudo nixos-rebuild switch # --flake .