nixos-config/machines/frigate/frigate/default.nix

147 lines
3.6 KiB
Nix

{ config, ... }:
{
virtualisation.oci-containers.containers = {
frigate = {
autoStart = true;
image = "ghcr.io/blakeblackshear/frigate:0.14.1";
ports = [
"1984:1984" # go2rtc
"5000:5000" # Unauthenticated Frigate endpoint
"8554:8554" # RTSP feeds
"8555:8555/tcp" # WebRTC over tcp
"8555:8555/udp" # WebRTC over udp
"8971:8971" # Authenticated Frigate endpoint
];
volumes = [
"/etc/localtime:/etc/localtime:ro"
"${./config/config.yml}:/config/config.yml:ro"
"/data/frigate:/media/frigate"
];
extraOptions = [
"--device"
"/dev/dri/renderD128"
"--device"
"/dev/apex_0"
"--shm-size=128m"
"--mount"
"type=tmpfs,target=/tmp/cache,tmpfs-size=1G"
"--cap-add"
"CAP_PERFMON"
];
environment = {
LIBVA_DRIVER_NAME = "iHD";
};
environmentFiles = [ config.sops.secrets.frigate.path ];
};
};
# services.frigate = {
# enable = true;
# hostname = "frigate.datarift.nl";
# settings = {
# mqtt = {
# enabled = true;
# host = "mqtt.datarift.nl";
# port = 1883;
# user = "frigate";
# password = "{FRIGATE_MQTT_PASSWORD}";
# };
# detectors = {
# coral = {
# type = "edgetpu";
# device = "pci";
# };
# };
# birdseye = {
# enabled = false;
# };
# ffmpeg = {
# hwaccel_args = "preset-vaapi";
# output_args = {
# record = "preset-record-generic-audio-aac";
# };
# };
# detect = {
# width = 640;
# height = 480;
# };
# objects = {
# track = [ "person" "cat" ];
# };
# record = {
# enabled = true;
# retain = {
# days = 4;
# };
# events = {
# retain = {
# default = 14;
# };
# };
# };
# snapshots = { };
# go2rtc = {
# streams = {
# deurbel = [
# "rtsp://hass:{FRIGATE_DOORBELL_PASSWORD}@10.0.0.31/h264Preview_01_main"
# "ffmpeg:deurbel#audio=opus"
# ];
# deurbel_sub = [
# "rtsp://hass:{FRIGATE_DOORBELL_PASSWORD}@10.0.0.31/h264Preview_01_sub"
# ];
# };
# webrtc = {
# candidates = [
# "10.0.0.205:8555"
# "stun:8555"
# ];
# };
# };
# cameras = {
# deurbel = {
# ffmpeg = {
# inputs = [
# {
# path = "rtsp://127.0.0.1:8554/deurbel?video=copy&audio=aac";
# input_args = "preset-rtsp-restream";
# roles = [ "record" ];
# }
# {
# path = "rtsp://127.0.0.1:8554/deurbel_sub?video=copy";
# input_args = "preset-rtsp-restream";
# roles = [ "detect" ];
# }
# ];
# };
# record = {
# events = {
# required_zones = [ "oprit" ];
# };
# };
# snapshots = {
# required_zones = [ "oprit" ];
# };
# zones = {
# oprit = {
# coordinates = "0,480,640,480,640,480,640,259,513,255,323,254,211,254,144,353,79,325,33,286,0,289";
# objects = [ "person" "cat" ];
# };
# };
# };
# };
# };
# };
# systemd.services.frigate.serviceConfig.EnvironmentFile = config.sops.secrets.frigate.path;
}