nixos/frigate: set LIBAVFORMAT_VERSION_MAJOR

Frigate uses this to select appropriate ffmpeg flags for compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bakhtiyar Neyman
2026-02-19 01:07:49 -08:00
co-authored by Claude Opus 4.6
parent 1d27f00d42
commit 2e7ea69665
+11
View File
@@ -699,6 +699,17 @@ in
environment = {
CONFIG_FILE = "/run/frigate/frigate.yml";
HOME = "/var/lib/frigate";
# Extract libavformat version in the same way Docker scripts in frigate directory do. This
# environment variable changes the flags given to `ffmpeg` improving compatibility.
LIBAVFORMAT_VERSION_MAJOR = lib.strings.trim (
builtins.readFile (
pkgs.runCommandLocal "libavformat-major-version" { } ''
${cfg.settings.ffmpeg.path}/bin/ffmpeg -version 2>&1 \
| sed -n 's/.*libavformat[[:space:]]*\([0-9]*\).*/\1/p' \
| head -1 > $out
''
)
);
PYTHONPATH = cfg.package.pythonPath;
}
// optionalAttrs (cfg.vaapiDriver != null) {