Need to write config to a file...

This commit is contained in:
niten 2023-11-26 17:38:26 -08:00
parent 8b43d0bd5a
commit 191429b307
1 changed files with 34 additions and 32 deletions

View File

@ -12,41 +12,43 @@ let
hostSecrets = config.fudo.secrets.host-secrets."${config.instance.hostname}"; hostSecrets = config.fudo.secrets.host-secrets."${config.instance.hostname}";
frigateCfg = builtins.toJSON { frigateCfg = let
mqtt = { content = builtins.toJSON {
enabled = true; mqtt = {
inherit (cfg.mqtt) host port user; enabled = true;
password = "{FRIGATE_MQTT_PASSWORD}"; inherit (cfg.mqtt) host port user;
}; password = "{FRIGATE_MQTT_PASSWORD}";
logger.default = cfg.log-level;
ffmpeg.hwaccel_args = [ "preset-intel-vaapi" ];
cameras = mapAttrs' (_: camOpts:
nameValuePair camOpts.name {
ffmpeg.inputs = [
{
path = camOpts.streams.high;
roles = [ "record" ];
}
{
path = camOpts.streams.low;
roles = [ "detect" ];
}
];
}) cfg.cameras;
detectors = cfg.detectors;
record = {
enabled = true;
retain = {
days = cfg.retention.default;
mode = "motion";
}; };
events.retain = { logger.default = cfg.log-level;
default = cfg.retention.events; ffmpeg.hwaccel_args = [ "preset-intel-vaapi" ];
mode = "active_objects"; cameras = mapAttrs' (_: camOpts:
objects = cfg.retention.objects; nameValuePair camOpts.name {
ffmpeg.inputs = [
{
path = camOpts.streams.high;
roles = [ "record" ];
}
{
path = camOpts.streams.low;
roles = [ "detect" ];
}
];
}) cfg.cameras;
detectors = cfg.detectors;
record = {
enabled = true;
retain = {
days = cfg.retention.default;
mode = "motion";
};
events.retain = {
default = cfg.retention.events;
mode = "active_objects";
objects = cfg.retention.objects;
};
}; };
}; };
}; in pkgs.writeText "frigate.yaml" content;
in { in {
options.services.frigateContainer = with types; { options.services.frigateContainer = with types; {