nixos-config/modules/frigate/default.nix

59 lines
1.6 KiB
Nix

{ config, lib, ... }:
with lib;
let
cfg = config.eboskma.services.frigate;
in
{
options.eboskma.services.frigate = { enable = mkEnableOption "frigate"; };
config = mkIf cfg.enable {
# docker run -d \
# --name frigate \
# --restart=unless-stopped \
# --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
# --device /dev/bus/usb:/dev/bus/usb \
# --device /dev/dri/renderD128 \
# --shm-size=64m \
# -v /path/to/your/storage:/media/frigate \
# -v /path/to/your/config.yml:/config/config.yml:ro \
# -v /etc/localtime:/etc/localtime:ro \
# -e FRIGATE_RTSP_PASSWORD='password' \
# -p 5000:5000 \
# -p 1935:1935 \
# blakeblackshear/frigate:stable
virtualisation.oci-containers.containers = {
frigate = {
autoStart = true;
image = "ghcr.io/blakeblackshear/frigate:0.12.0";
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"
"/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
];
};
};
};
}