Frigate NVR Nix-Config

I am wondering if anyone has a working Nix-Config example of frigate running on NIX.
https://search.nixos.org/packages?channel=23.05&show=frigate&from=0&size=50&sort=relevance&type=packages&query=frigate

Thanks

John

2 Likes

The module optionss are here:

https://search.nixos.org/options?channel=23.05&show=services.frigate.settings&from=0&size=50&sort=relevance&type=packages&query=frigate

Here is what I tested the setup with, when I packaged frigate.

  services.frigate = {
    enable = false;
    hostname = "localhost";

    settings = {
      mqtt.enabled = false;

      #detectors.ov = {
      #  type = "openvino";
      #  device = "AUTO";
      #  model.path = "/var/lib/frigate/openvino-model/ssdlite_mobilenet_v2.xml";
      #};

      record = {
        enabled = true;
        retain = {
          days = 2;
          mode = "all";
        };
      };

      ffmpeg.hwaccel_args = "preset-vaapi";

      cameras."test1" = {
        ffmpeg.inputs = [ {
          path = "rtsp://127.0.0.1:8554/test1";
          input_args = "preset-rtsp-restream";
          roles = [ "record" ];
        } ];
      };
      cameras."test2" = {
        ffmpeg.inputs = [ {
          path = "rtsp://localaccount:localaccount@172.20.65.103:554/stream1";
          roles = [
            "record"
            "detect"
          ];
        } ];
      };
    };
  };

  # hwdec for amdgpu
  systemd.services.frigate = {
    environment.LIBVA_DRIVER_NAME = "radeonsi";
    serviceConfig = {
      SupplementaryGroups = ["render" "video"] ; # for access to dev/dri/*
      AmbientCapabilities = "CAP_PERFMON";
    };
  };

  services.go2rtc = {
    enable = false;
    settings = {
      streams = {
        "test1" = [
          "rtsp://10.83.16.12/11"
        ];
      };
      rtsp.listen = ":8554";
      webrtc.listen = ":8555";
    };
  };
5 Likes

Hi, hexa - I’ve got your frigate module working insofar as frigate itself, but I’m running traefik on ports 80/443 on the same machine and the nginx service that the frigate module starts cannot bind and fails. Generally speaking, is there an easy way to run this frigate module alongside traefik, or would I be better off just using the containerized version on my nixos machine? Here is a link to my frigate module if helpful (traefik configs to pass through to nginx near the bottom): nixos-configs/nixos-system/host-specific/aspen/frigate.nix at f828e68a5019a6f3dcca2bdf91ae4cff4347a650 · dc-bond/nixos-configs · GitHub

You could bind the nginx vhost to a different port and reverse proxy that. The whole app is unfortunately married to nginx for several reasons.