move frigate to its own module
This commit is contained in:
1
data.nix
1
data.nix
@@ -24,6 +24,7 @@ rec {
|
|||||||
immich-server = 3002;
|
immich-server = 3002;
|
||||||
immich-machine-learning = 3003; # as of writing, hardcoded in the immich module
|
immich-machine-learning = 3003; # as of writing, hardcoded in the immich module
|
||||||
|
|
||||||
|
frigate = 5000;
|
||||||
soju = 6697;
|
soju = 6697;
|
||||||
soju-ws = 6698;
|
soju-ws = 6698;
|
||||||
matrix-synapse = 8008;
|
matrix-synapse = 8008;
|
||||||
|
|||||||
@@ -112,16 +112,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
frigate = {
|
|
||||||
preStart = "ln -sf $CREDENTIALS_DIRECTORY/secrets.env /run/frigate/secrets.env";
|
|
||||||
serviceConfig = {
|
|
||||||
EnvironmentFile = [ "-/run/frigate/secrets.env" ];
|
|
||||||
Environment = [ "PYTHONPERFSUPPORT=1" ];
|
|
||||||
RuntimeDirectory = "frigate";
|
|
||||||
LoadCredential = [ "secrets.env:${config.age.secrets.frigate.path}" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nginx =
|
nginx =
|
||||||
let
|
let
|
||||||
r1 = config.mj.services.nsd-acme.zones."r1.jakstys.lt";
|
r1 = config.mj.services.nsd-acme.zones."r1.jakstys.lt";
|
||||||
@@ -382,77 +372,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
frigate = {
|
|
||||||
enable = true;
|
|
||||||
hostname = "r1.jakstys.lt";
|
|
||||||
settings = {
|
|
||||||
detect = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
detectors = {
|
|
||||||
coral = {
|
|
||||||
type = "edgetpu";
|
|
||||||
device = "usb";
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
record = {
|
|
||||||
enabled = true;
|
|
||||||
retain = {
|
|
||||||
days = 7;
|
|
||||||
mode = "all";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
cameras = {
|
|
||||||
vno4-dome-panorama = {
|
|
||||||
enabled = true;
|
|
||||||
ffmpeg = {
|
|
||||||
hwaccel_args = "preset-vaapi";
|
|
||||||
output_args = {
|
|
||||||
record = "preset-record-generic-audio-copy";
|
|
||||||
};
|
|
||||||
inputs = [
|
|
||||||
{
|
|
||||||
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=1&subtype=0";
|
|
||||||
roles = [
|
|
||||||
"audio"
|
|
||||||
"record"
|
|
||||||
#"detect"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=1&subtype=1";
|
|
||||||
roles = [ "detect" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
vno4-dome-ptz = {
|
|
||||||
enabled = true;
|
|
||||||
ffmpeg = {
|
|
||||||
output_args = {
|
|
||||||
record = "preset-record-generic-audio-copy";
|
|
||||||
};
|
|
||||||
inputs = [
|
|
||||||
{
|
|
||||||
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=0";
|
|
||||||
roles = [
|
|
||||||
"audio"
|
|
||||||
"record"
|
|
||||||
#"detect"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=1";
|
|
||||||
roles = [ "detect" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nsd = {
|
nsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = [
|
interfaces = [
|
||||||
@@ -573,6 +492,11 @@ in
|
|||||||
extraSubnets = [ myData.subnets.vno1.cidr ];
|
extraSubnets = [ myData.subnets.vno1.cidr ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
frigate = {
|
||||||
|
enable = true;
|
||||||
|
secretsEnv = config.age.secrets.frigate.path;
|
||||||
|
};
|
||||||
|
|
||||||
immich = {
|
immich = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bindPaths = {
|
bindPaths = {
|
||||||
@@ -775,8 +699,8 @@ in
|
|||||||
tcp = with myData.ports; [
|
tcp = with myData.ports; [
|
||||||
80
|
80
|
||||||
443
|
443
|
||||||
5000 # todo move to frigate
|
|
||||||
soju
|
soju
|
||||||
|
frigate
|
||||||
soju-ws
|
soju-ws
|
||||||
prometheus
|
prometheus
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
./btrfssnapshot
|
./btrfssnapshot
|
||||||
./deployerbot
|
./deployerbot
|
||||||
./friendlyport
|
./friendlyport
|
||||||
|
./frigate
|
||||||
./gitea
|
./gitea
|
||||||
./grafana
|
./grafana
|
||||||
./hass
|
./hass
|
||||||
|
|||||||
98
modules/services/frigate/default.nix
Normal file
98
modules/services/frigate/default.nix
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.mj.services.frigate;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mj.services.frigate = with lib.types; {
|
||||||
|
enable = lib.mkEnableOption "enable frigate";
|
||||||
|
secretsEnv = lib.mkOption { type = path; };
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.frigate = {
|
||||||
|
preStart = "ln -sf $CREDENTIALS_DIRECTORY/secrets.env /run/frigate/secrets.env";
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = [ "-/run/frigate/secrets.env" ];
|
||||||
|
Environment = [ "PYTHONPERFSUPPORT=1" ];
|
||||||
|
RuntimeDirectory = "frigate";
|
||||||
|
LoadCredential = [ "secrets.env:${cfg.secretsEnv}" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.frigate = {
|
||||||
|
enable = true;
|
||||||
|
hostname = "r1.jakstys.lt";
|
||||||
|
settings = {
|
||||||
|
detect = {
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
detectors = {
|
||||||
|
coral = {
|
||||||
|
type = "edgetpu";
|
||||||
|
device = "usb";
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
record = {
|
||||||
|
enabled = true;
|
||||||
|
retain = {
|
||||||
|
days = 7;
|
||||||
|
mode = "all";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
cameras = {
|
||||||
|
vno4-dome-panorama = {
|
||||||
|
enabled = true;
|
||||||
|
ffmpeg = {
|
||||||
|
hwaccel_args = "preset-vaapi";
|
||||||
|
output_args = {
|
||||||
|
record = "preset-record-generic-audio-copy";
|
||||||
|
};
|
||||||
|
inputs = [
|
||||||
|
{
|
||||||
|
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=1&subtype=0";
|
||||||
|
roles = [
|
||||||
|
"audio"
|
||||||
|
"record"
|
||||||
|
#"detect"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=1&subtype=1";
|
||||||
|
roles = [ "detect" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
vno4-dome-ptz = {
|
||||||
|
enabled = true;
|
||||||
|
ffmpeg = {
|
||||||
|
output_args = {
|
||||||
|
record = "preset-record-generic-audio-copy";
|
||||||
|
};
|
||||||
|
inputs = [
|
||||||
|
{
|
||||||
|
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=0";
|
||||||
|
roles = [
|
||||||
|
"audio"
|
||||||
|
"record"
|
||||||
|
#"detect"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
path = "rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=1";
|
||||||
|
roles = [ "detect" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user