I am trying to setup the Frigate NVR service to work with some ONVIF cameras. I can get the basic service running, but it appears to be failing to load a python module needed for using the ONVIF stuff.
I get the following error when it tries:
Apr 10 17:10:10 frigate python3.11[461]: [2024-04-10 17:10:10] frigate.ptz.onvif ERROR : Onvif connection to kitchen failed: Unknown error: No such file: /nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/lib/python3.11/site-packages/wsdl/devicemgmt.wsdl
The path specified exists up to the site-packages
directory, but there is no wsdl
under it. I donāt understand enough about how python works in NixOS to try to debug why that path is wrongā¦
Iām running the frigate service in a nixos declarative container, because I want to isolate its listeners. The relevant bits of my config:
{ config, pkgs, lib, ... }:
with lib;
{
containers.frigate = rec {
autoStart = true;
privateNetwork = true;
hostAddress = "192.168.1.1";
localAddress = "192.168.111.1/32";
ephemeral = true;
bindMounts = {
"/etc/resolv.conf" = {
hostPath = "/etc/resolv.conf";
isReadOnly = true;
};
"/var/lib/frigate" = {
hostPath = "/var/lib/frigate";
isReadOnly = false;
};
"/var/log" = {
hostPath = "/var/log/frigate";
isReadOnly = false;
};
# TODO: Why does this fail if I use the variable?
# "${config.age.secrets.foscam-password.path}" = {
"/run/agenix/foscam-password" = {
isReadOnly = true;
};
};
forwardPorts = [{
containerPort = 80;
hostPort = 8125;
protocol = "tcp";
}];
# Reference article for NixOS containers:
# https://blog.beardhatcode.be/2020/12/Declarative-Nixos-Containers.html
config = { config, pkgs, lib, ... }: {
system.stateVersion = "23.05";
systemd.services.frigate.serviceConfig = {
EnvironmentFile = "/run/agenix/foscam-password";
};
services.frigate = rec {
enable = true;
# Frigate upstream itself sets up nginx with a reverse proxy, and
# uses the hostname specified here.
hostname = "frigate";
settings = {
mqtt = {
enabled = true;
host = "${hostAddress}";
port = 1883;
};
cameras = rec {
kitchen = {
onvif = {
host = "kitchen-camera.minego.net";
port = 888;
user = "minego";
password= "{FRIGATE_FOSCAM_PASS}";
};
ffmpeg.inputs = [{
path = "rtsp://minego:{FRIGATE_FOSCAM_PASS}@kitchen-camera.minego.net:88/videoSub";
roles = [ "detect" "record" ];
}];
};
};
};
};
networking = {
firewall = {
# Container ports
allowedTCPPorts = [ 80 ];
};
};
};
};
networking.firewall = {
# Host ports
allowedTCPPorts = [ 8125 ];
};
}