nixos-config/modules/frigate/default.nix

58 lines
1.6 KiB
Nix
Raw Normal View History

2023-03-21 17:20:22 +01:00
{ 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-rc1";
2023-03-21 17:20:22 +01:00
ports = [
"5000:5000"
"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"
"/data/frigate:/media/frigate"
];
extraOptions = [
# "--device" "/dev/bus/usb:/dev/bus/usb"
"--device"
"/dev/dri/renderD128"
"--shm-size=128m"
"--mount"
"type=tmpfs,target=/tmp/cache,tmpfs-size=1G"
];
environment = {
LIBVA_DRIVER_NAME = "i965";
};
2023-03-21 17:20:22 +01:00
environmentFiles = [
config.sops.secrets.frigate.path
];
};
};
};
}