154 lines
4 KiB
Nix
154 lines
4 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
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;
|
|
image = "ghcr.io/blakeblackshear/frigate:0.12.1";
|
|
ports = [
|
|
"1984:1984" # go2rtc
|
|
"5000:5000" # Frigate
|
|
"8554:8554" # RTSP feeds
|
|
"8555:8555/tcp" # WebRTC over tcp
|
|
"8555:8555/udp" # WebRTC over udp
|
|
];
|
|
volumes = [
|
|
"/etc/localtime:/etc/localtime:ro"
|
|
"${./config.yml}:/config/config.yml:ro"
|
|
"${pkgs.go2rtc}/bin/go2rtc:/config/go2rtc"
|
|
"/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"
|
|
];
|
|
environment = {
|
|
LIBVA_DRIVER_NAME = "i965";
|
|
};
|
|
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;
|
|
};
|
|
}
|