From 191429b3072882897356b2f2afd6dc5f7459cc28 Mon Sep 17 00:00:00 2001 From: niten Date: Sun, 26 Nov 2023 17:38:26 -0800 Subject: [PATCH] Need to write config to a file... --- frigate-container.nix | 66 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/frigate-container.nix b/frigate-container.nix index 867a9b4..226cef5 100644 --- a/frigate-container.nix +++ b/frigate-container.nix @@ -12,41 +12,43 @@ let hostSecrets = config.fudo.secrets.host-secrets."${config.instance.hostname}"; - frigateCfg = builtins.toJSON { - mqtt = { - enabled = true; - 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"; + frigateCfg = let + content = builtins.toJSON { + mqtt = { + enabled = true; + inherit (cfg.mqtt) host port user; + password = "{FRIGATE_MQTT_PASSWORD}"; }; - events.retain = { - default = cfg.retention.events; - mode = "active_objects"; - objects = cfg.retention.objects; + 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 = { + default = cfg.retention.events; + mode = "active_objects"; + objects = cfg.retention.objects; + }; }; }; - }; + in pkgs.writeText "frigate.yaml" content; in { options.services.frigateContainer = with types; {