From 9e13f06027f5e3aa770dd653e8c54edfe57fb7db Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Tue, 23 Dec 2025 15:18:38 -0500 Subject: [PATCH] frigate to quadlet --- hosts/nixos/HandlerOne/default.nix | 3 +- .../frigate/default.nix | 87 ++++--------------- 2 files changed, 17 insertions(+), 73 deletions(-) rename modules/{services => quadlets}/frigate/default.nix (71%) diff --git a/hosts/nixos/HandlerOne/default.nix b/hosts/nixos/HandlerOne/default.nix index 762d420..a47157e 100644 --- a/hosts/nixos/HandlerOne/default.nix +++ b/hosts/nixos/HandlerOne/default.nix @@ -42,11 +42,12 @@ # Quadlets "modules/quadlets" "modules/quadlets/booklore" + "modules/quadlets/frigate" # Hosted services "modules/services/mealie" "modules/services/actualbudget" - "modules/services/frigate" + # "modules/services/frigate" "modules/services/homepage" "modules/services/mqtt" "modules/services/lubelogger" diff --git a/modules/services/frigate/default.nix b/modules/quadlets/frigate/default.nix similarity index 71% rename from modules/services/frigate/default.nix rename to modules/quadlets/frigate/default.nix index a194c29..fada432 100644 --- a/modules/services/frigate/default.nix +++ b/modules/quadlets/frigate/default.nix @@ -1,15 +1,14 @@ -let - volumePath = "/overseer/services"; -in { - pkgs, - inputs, lib, config, + inputs, + pkgs, ... }: let - sopsFolder = builtins.toString inputs.nix-secrets + "/sops"; + securePort = builtins.toString (lib.custom.autoport "frigate-secure"); + volumePath = "/overseer/services"; + sopsFolder = inputs.nix-secrets + "/sops"; frigateConfig = pkgs.writeText "frigate-config.yaml" ( lib.generators.toYAML { } { auth.enabled = false; # Proxy auth @@ -48,18 +47,6 @@ let wce-0002_sub = [ "rtsp://thingino:thingino@192.168.150.2:554/ch1" ]; - wce-0003 = [ - "rtsp://thingino:thingino@192.168.150.3:554/ch0" - ]; - wce-0003_sub = [ - "rtsp://thingino:thingino@192.168.150.3:554/ch1" - ]; - #wce-0004 = [ - # "rtsp://192.168.0.210:554/media/live/1/1" - # ]; - # wce-0004_sub = [ - # "rtsp://192.168.0.210:554/media/live/1/2" - # ]; }; }; ############# @@ -151,46 +138,6 @@ let }; detect.enabled = true; }; - wce-0003 = { - ffmpeg = { - inputs = [ - { - path = "rtsp://127.0.0.1:8554/wce-0003"; - roles = [ "record" ]; - } - { - path = "rtsp://127.0.0.1:8554/wce-0003_sub"; - roles = [ "detect" ]; - } - ]; - }; - motion = { - enabled = true; - mask = [ - "0,0,0.196,0.002,0.195,0.045,0,0.043" # timestamp - "0.898,0,0.896,0.045,1,0.048,0.999,0.002" # uptime - ]; - }; - detect.enabled = true; - }; - # wce-0004 = { - # ffmpeg = { - # inputs = [ - # { - # path = "rtsp://127.0.0.1:8554/wce-0004"; - # roles = ["record"]; - # } - # { - # path = "rtsp://127.0.0.1:8554/wce-0004_sub"; - # roles = ["detect"]; - # } - # ]; - # }; - # motion = { - # enabled = true; - # }; - # detect.enabled = true; - # }; }; } ); @@ -212,28 +159,24 @@ in "d ${volumePath}/frigate/db" "f ${volumePath}/frigate/db/frigate.db" ]; - ########### - # Service # - ########### - virtualisation.oci-containers = { - backend = "podman"; + virtualisation.quadlet = { containers = { - "frigate" = { + frigate.containerConfig = { image = "ghcr.io/blakeblackshear/frigate:0.17.0-beta1"; environmentFiles = [ config.sops.templates."frigate_env".path ]; + devices = [ + "/dev/bus/usb:/dev/bus/usb" + ]; + shmSize = "612m"; volumes = [ "/etc/localtime:/etc/localtime:ro" "${volumePath}/frigate/media/frigate:/media/frigate" - "${frigateConfig}:/config/config.yaml" # :ro to set to readonly + "${frigateConfig}:/config/config.yaml:ro" # :ro to set to readonly "${volumePath}/frigate/db/frigate.db:/config/frigate.db" ]; - extraOptions = [ - "--shm-size=612m" - "--ip=10.88.0.10" - ]; - devices = [ - "/dev/bus/usb:/dev/bus/usb" + publishPorts = [ + "${securePort}:8971" ]; }; }; @@ -251,7 +194,7 @@ in } route /* { authorize with frigate - reverse_proxy http://10.88.0.10:8971 + reverse_proxy http://localhost:${securePort} } ''; };