2023-07-04 20:29:59 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
2023-03-21 17:20:22 +01:00
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.eboskma.services.frigate;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.eboskma.services.frigate = { enable = mkEnableOption "frigate"; };
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
frigate = {
|
|
|
|
autoStart = true;
|
2023-07-04 20:29:59 +02:00
|
|
|
image = "ghcr.io/blakeblackshear/frigate:0.12.1";
|
2023-03-21 17:20:22 +01:00
|
|
|
ports = [
|
2023-04-19 09:32:36 +02:00
|
|
|
"1984:1984" # go2rtc
|
|
|
|
"5000:5000" # Frigate
|
2023-03-27 19:08:59 +02:00
|
|
|
"8554:8554" # RTSP feeds
|
|
|
|
"8555:8555/tcp" # WebRTC over tcp
|
|
|
|
"8555:8555/udp" # WebRTC over udp
|
2023-03-21 17:20:22 +01:00
|
|
|
];
|
|
|
|
volumes = [
|
|
|
|
"/etc/localtime:/etc/localtime:ro"
|
|
|
|
"${./config.yml}:/config/config.yml:ro"
|
2023-07-04 20:29:59 +02:00
|
|
|
"${pkgs.go2rtc}/bin/go2rtc:/config/go2rtc"
|
2023-03-21 17:20:22 +01:00
|
|
|
"/data/frigate:/media/frigate"
|
|
|
|
];
|
|
|
|
extraOptions = [
|
|
|
|
"--device"
|
|
|
|
"/dev/dri/renderD128"
|
2023-05-15 14:29:19 +02:00
|
|
|
"--device"
|
|
|
|
"/dev/apex_0"
|
2023-03-21 17:20:22 +01:00
|
|
|
"--shm-size=128m"
|
|
|
|
"--mount"
|
|
|
|
"type=tmpfs,target=/tmp/cache,tmpfs-size=1G"
|
|
|
|
];
|
2023-03-24 14:24:06 +01:00
|
|
|
environment = {
|
|
|
|
LIBVA_DRIVER_NAME = "i965";
|
|
|
|
};
|
2023-03-21 17:20:22 +01:00
|
|
|
environmentFiles = [
|
|
|
|
config.sops.secrets.frigate.path
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-07-04 20:29:59 +02:00
|
|
|
# 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;
|
2023-03-21 17:20:22 +01:00
|
|
|
};
|
|
|
|
}
|