From 8e935ab6aa014a0918bb57a774530b7906045c0b Mon Sep 17 00:00:00 2001 From: 514fpv Date: Fri, 2 Feb 2024 07:33:17 +0800 Subject: [PATCH] feat(eientei): add frigate --- spec/eientei/frigate.nix | 30 ++++++++++++++++++++++++++++++ spec/eientei/mosquitto.nix | 13 +++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 spec/eientei/frigate.nix create mode 100644 spec/eientei/mosquitto.nix diff --git a/spec/eientei/frigate.nix b/spec/eientei/frigate.nix new file mode 100644 index 00000000..c3239f10 --- /dev/null +++ b/spec/eientei/frigate.nix @@ -0,0 +1,30 @@ +{ pkgs +, config +, ...}: { + # container image used for edgetpu support + virtualisation.oci-containers.containers.frigate = { + extraOptions = [ + "--privileged" + "--shm-size=128mb" + "--device=/dev/bus/usb:/dev/bus/usb" + ]; + image = "ghcr.io/blakeblackshear/frigate:stable"; + volumes = [ + "/etc/localtime:/etc/localtime:ro" + "/nix/persist/service/frigate/config:/config" + "/nix/persist/service/frigate/data:/media/frigate" + #"/tmp/frigate:/tmp/cache" + ]; + ports = [ + "5000:5000" + "8554:8554" # RTSP feeds + "8555:8555/tcp" # WebRTC over tcp + "8555:8555/udp" # WebRTC over udp + ]; + }; + + networking.firewall.interfaces.enp0s20f0u1.allowedTCPPorts = [ 5000 8554 8555 ]; + networking.firewall.interfaces.enp0s20f0u1.allowedUDPPorts = [ 8555 ]; + + global.fs.zfs.mountpoints."/nix/persist/service/frigate" = "service/frigate"; +} diff --git a/spec/eientei/mosquitto.nix b/spec/eientei/mosquitto.nix new file mode 100644 index 00000000..42fd0639 --- /dev/null +++ b/spec/eientei/mosquitto.nix @@ -0,0 +1,13 @@ +{ + services.mosquitto = { + enable = true; + listeners = [ { + users.frigate = { + acl = [ "readwrite #" ]; + hashedPassword = "$7$101$Zt3Me3AkHbrKBbbI$SsLTGeTwtkFGXS2F1/S3Vg6w7TcgMLU037ttedKaw/Ela0wgqbaAVxecK1j5i5TDw9OjZMkNI9mUzz9l0d7vcg=="; + }; + } ]; + }; + + networking.firewall.allowedTCPPorts = [ 1883 ]; +}