{ config, pkgs, lib, ... }: with lib; let helper = import ./lib.nix { inherit config pkgs lib; }; cfg = config.numbus.services.frigate; in helper.mkPodmanService { name = "frigate"; description = "Frigate, your fully-local NVR (Network Video Recorder)"; defaultPort = "8971"; pod = "home-assistant"; scheme = "https"; dependencies = [ "traefik.service" "${config.numbus.services.dns}.service" "home-assistant.service" ]; extraOptions = { devices = mkOption { type = types.listOf types.str; default = []; example = [ "/dev/dri:/dev/dri" "/dev/bus/usb:/dev/bus/usb" "/dev/apex_0:/dev/apex_0" ]; description = "List of devices to map into the container. /dev/dri is used for graphics acceleration, /dev/bus/usb for USB Coral TPUs, and /dev/apex_0 for PCI coral TPUs"; }; }; composeText = '' services: frigate: image: ghcr.io/blakeblackshear/frigate:stable container_name: frigate hostname: frigate shm_size: "256mb" networks: home-assistant_frontend: home-assistant_backend: ports: - "${cfg.port}:8971/tcp" volumes: - ${cfg.configDir}:/config - ${cfg.dataDir}:/media/frigate - /etc/localtime:/etc/localtime:ro - type: tmpfs target: /tmp/cache tmpfs: size: 1000000000 environment: - FRIGATE_MQTT_USER=$FRIGATE_MQTT_USER - FRIGATE_MQTT_PASSWORD=$FRIGATE_MQTT_PASSWORD ${lib.optionalString (cfg.devices != []) '' devices: ${lib.concatStringsSep "\n" (map (d: " - \"${d}\"") cfg.devices)} ''} restart: unless-stopped networks: home-assistant_backend: external: true home-assistant_frontend: external: true ''; }