push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
diff --git a/frigate/comms/webpush.py b/frigate/comms/webpush.py
index c5986d45..b767e19e 100644
--- a/frigate/comms/webpush.py
+++ b/frigate/comms/webpush.py
@@ -17,7 +17,7 @@ from titlecase import titlecase
from frigate.comms.base_communicator import Communicator
from frigate.comms.config_updater import ConfigSubscriber
from frigate.config import FrigateConfig
-from frigate.const import CONFIG_DIR
+from frigate.const import BASE_DIR, CONFIG_DIR
from frigate.models import User
logger = logging.getLogger(__name__)
@@ -333,7 +333,7 @@ class WebPushClient(Communicator): # type: ignore[misc]
title = f"{titlecase(', '.join(sorted_objects).replace('_', ' '))}{' was' if state == 'end' else ''} detected in {titlecase(', '.join(payload['after']['data']['zones']).replace('_', ' '))}"
message = f"Detected on {titlecase(camera.replace('_', ' '))}"
- image = f"{payload['after']['thumb_path'].replace('/media/frigate', '')}"
+ image = f"{payload['after']['thumb_path'].replace(BASE_DIR, '')}"
# if event is ongoing open to live view otherwise open to recordings view
direct_url = f"/review?id={reviewId}" if state == "end" else f"/#{camera}"

View File

@@ -0,0 +1,47 @@
diff --git a/frigate/config/camera/ffmpeg.py b/frigate/config/camera/ffmpeg.py
index 04bbfac7..396bcc4b 100644
--- a/frigate/config/camera/ffmpeg.py
+++ b/frigate/config/camera/ffmpeg.py
@@ -1,4 +1,5 @@
from enum import Enum
+from os.path import join
from typing import Union
from pydantic import Field, field_validator
@@ -69,21 +70,11 @@ class FfmpegConfig(FrigateBaseModel):
@property
def ffmpeg_path(self) -> str:
- if self.path == "default":
- return f"/usr/lib/ffmpeg/{DEFAULT_FFMPEG_VERSION}/bin/ffmpeg"
- elif self.path in INCLUDED_FFMPEG_VERSIONS:
- return f"/usr/lib/ffmpeg/{self.path}/bin/ffmpeg"
- else:
- return f"{self.path}/bin/ffmpeg"
+ return join(self.path, "bin/ffmpeg")
@property
def ffprobe_path(self) -> str:
- if self.path == "default":
- return f"/usr/lib/ffmpeg/{DEFAULT_FFMPEG_VERSION}/bin/ffprobe"
- elif self.path in INCLUDED_FFMPEG_VERSIONS:
- return f"/usr/lib/ffmpeg/{self.path}/bin/ffprobe"
- else:
- return f"{self.path}/bin/ffprobe"
+ return join(self.path, "bin/ffprobe")
class CameraRoleEnum(str, Enum):
diff --git a/frigate/record/export.py b/frigate/record/export.py
index 0d3f96da..463bcff4 100644
--- a/frigate/record/export.py
+++ b/frigate/record/export.py
@@ -126,7 +126,7 @@ class RecordingExporter(threading.Thread):
minutes = int(diff / 60)
seconds = int(diff % 60)
ffmpeg_cmd = [
- "/usr/lib/ffmpeg/7.0/bin/ffmpeg", # hardcode path for exports thumbnail due to missing libwebp support
+ self.config.ffmpeg.ffmpeg_path, # hardcode path for exports thumbnail due to missing libwebp support
"-hide_banner",
"-loglevel",
"warning",

View File

@@ -0,0 +1,254 @@
{
lib,
stdenv,
callPackage,
python312Packages,
fetchFromGitHub,
fetchurl,
ffmpeg-headless,
sqlite-vec,
frigate,
nixosTests,
fetchpatch,
}:
let
version = "0.16.1";
src = fetchFromGitHub {
name = "frigate-${version}-source";
owner = "blakeblackshear";
repo = "frigate";
tag = "v${version}";
hash = "sha256-Uhqs9n4igP9+BtIHiEiurjvKfo2prIXnnVXqyPDbzQ8=";
};
frigate-web = callPackage ./web.nix {
inherit version src;
};
python = python312Packages.python.override {
packageOverrides = self: super: {
joserfc = super.joserfc.overridePythonAttrs (oldAttrs: {
version = "1.1.0";
src = fetchFromGitHub {
owner = "authlib";
repo = "joserfc";
tag = version;
hash = "sha256-95xtUzzIxxvDtpHX/5uCHnTQTB8Fc08DZGUOR/SdKLs=";
};
});
onnxruntime = super.onnxruntime.override (old: {
onnxruntime = old.onnxruntime.override (old: {
withFullProtobuf = true;
});
});
};
};
python3Packages = python.pkgs;
# Tensorflow audio model
# https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/Dockerfile#L125
tflite_audio_model = fetchurl {
url = "https://www.kaggle.com/api/v1/models/google/yamnet/tfLite/classification-tflite/1/download";
hash = "sha256-G5cbITJ2AnOl+49dxQToZ4OyeFO7MTXVVa4G8eHjZfM=";
};
# Tensorflow Lite models
# https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/Dockerfile#L115-L117
tflite_cpu_model = fetchurl {
url = "https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite";
hash = "sha256-kLszpjTgQZFMwYGapd+ZgY5sOWxNLblSwP16nP/Eck8=";
};
tflite_edgetpu_model = fetchurl {
url = "https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite";
hash = "sha256-Siviu7YU5XbVbcuRT6UnUr8PE0EVEnENNV2X+qGzVkE=";
};
# TODO: OpenVino model
# https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/Dockerfile#L64-L77
# https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/Dockerfile#L120-L123
# Convert https://www.kaggle.com/models/tensorflow/ssdlite-mobilenet-v2 with https://github.com/blakeblackshear/frigate/blob/v0.15.0/docker/main/build_ov_model.py into OpenVino IR format
coco_91cl_bkgr = fetchurl {
url = "https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt";
hash = "sha256-5Cj2vEiWR8Z9d2xBmVoLZuNRv4UOuxHSGZQWTJorXUQ=";
};
in
python3Packages.buildPythonApplication rec {
pname = "frigate";
inherit version;
format = "other";
inherit src;
patches = [
./constants.patch
# Fixes hardcoded path /media/frigate/clips/faces. Remove in next version.
(fetchpatch {
url = "https://github.com/blakeblackshear/frigate/commit/b86e6e484f64bd43b64d7adebe78671a7a426edb.patch";
hash = "sha256-1+n0n0yCtjfAHkXzsZdIF0iCVdPGmsG7l8/VTqBVEjU=";
})
./ffmpeg.patch
];
postPatch = ''
echo 'VERSION = "${version}"' > frigate/version.py
substituteInPlace \
frigate/app.py \
frigate/test/test_{http,storage}.py \
frigate/test/http_api/base_http_test.py \
--replace-fail "Router(migrate_db)" 'Router(migrate_db, "${placeholder "out"}/share/frigate/migrations")'
substituteInPlace frigate/const.py \
--replace-fail "/opt/frigate" "${placeholder "out"}/${python.sitePackages}" \
--replace-fail "/media/frigate" "/var/lib/frigate" \
--replace-fail "/tmp/cache" "/var/cache/frigate" \
--replace-fail "/config" "/var/lib/frigate" \
--replace-fail "{CONFIG_DIR}/model_cache" "/var/cache/frigate/model_cache"
substituteInPlace frigate/comms/{config,embeddings}_updater.py frigate/comms/{zmq_proxy,inter_process}.py \
--replace-fail "ipc:///tmp/cache" "ipc:///run/frigate"
substituteInPlace frigate/db/sqlitevecq.py \
--replace-fail "/usr/local/lib/vec0" "${lib.getLib sqlite-vec}/lib/vec0${stdenv.hostPlatform.extensions.sharedLibrary}"
# provide default paths for models and maps that are shipped with frigate
substituteInPlace frigate/config/config.py \
--replace-fail "/cpu_model.tflite" "${tflite_cpu_model}" \
--replace-fail "/edgetpu_model.tflite" "${tflite_edgetpu_model}"
substituteInPlace frigate/detectors/detector_config.py \
--replace-fail "/labelmap.txt" "${placeholder "out"}/share/frigate/labelmap.txt"
substituteInPlace frigate/events/audio.py \
--replace-fail "/cpu_audio_model.tflite" "${placeholder "out"}/share/frigate/cpu_audio_model.tflite" \
--replace-fail "/audio-labelmap.txt" "${placeholder "out"}/share/frigate/audio-labelmap.txt"
'';
dontBuild = true;
dependencies = with python3Packages; [
# docker/main/requirements.txt
scikit-build
# docker/main/requirements-wheel.txt
aiofiles
aiohttp
appdirs
argcomplete
contextlib2
click
distlib
fastapi
filelock
future
importlib-metadata
importlib-resources
google-generativeai
joserfc
levenshtein
markupsafe
netaddr
netifaces
norfair
numpy
ollama
onnxruntime
onvif-zeep-async
openai
opencv4
openvino
paho-mqtt
pandas
pathvalidate
peewee
peewee-migrate
prometheus-client
psutil
py3nvml
pyclipper
pydantic
python-multipart
pytz
py-vapid
pywebpush
pyzmq
requests
ruamel-yaml
scipy
setproctitle
shapely
slowapi
starlette
starlette-context
tensorflow-bin
titlecase
transformers
tzlocal
unidecode
uvicorn
verboselogs
virtualenv
ws4py
];
installPhase = ''
runHook preInstall
mkdir -p $out/${python.sitePackages}/frigate
cp -R frigate/* $out/${python.sitePackages}/frigate/
mkdir -p $out/share/frigate
cp -R {migrations,labelmap.txt,audio-labelmap.txt} $out/share/frigate/
tar --extract --gzip --file ${tflite_audio_model}
cp --no-preserve=mode ./1.tflite $out/share/frigate/cpu_audio_model.tflite
cp --no-preserve=mode ${coco_91cl_bkgr} $out/share/frigate/coco_91cl_bkgr.txt
sed -i 's/truck/car/g' $out/share/frigate/coco_91cl_bkgr.txt
runHook postInstall
'';
nativeCheckInputs = with python3Packages; [
ffmpeg-headless
pytestCheckHook
];
# interpreter crash in onnxruntime on aarch64-linux
doCheck = !(stdenv.hostPlatform.system == "aarch64-linux");
preCheck = ''
# Unavailable in the build sandbox
substituteInPlace frigate/const.py \
--replace-fail "/var/lib/frigate" "$TMPDIR/" \
--replace-fail "/var/cache/frigate" "$TMPDIR"
'';
disabledTests = [
# Test needs network access
"test_plus_labelmap"
];
passthru = {
web = frigate-web;
inherit python;
pythonPath = (python3Packages.makePythonPath dependencies) + ":${frigate}/${python.sitePackages}";
tests = {
inherit (nixosTests) frigate;
};
};
meta = with lib; {
changelog = "https://github.com/blakeblackshear/frigate/releases/tag/${src.tag}";
description = "NVR with realtime local object detection for IP cameras";
longDescription = ''
A complete and local NVR designed for Home Assistant with AI
object detection. Uses OpenCV and Tensorflow to perform realtime
object detection locally for IP cameras.
'';
homepage = "https://github.com/blakeblackshear/frigate";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
};
}

View File

@@ -0,0 +1,40 @@
{
buildNpmPackage,
frigate,
src,
version,
}:
buildNpmPackage {
pname = "frigate-web";
inherit version src;
sourceRoot = "${src.name}/web";
postPatch = ''
substituteInPlace package.json \
--replace-fail "--base=/BASE_PATH/" ""
substituteInPlace \
src/pages/Exports.tsx \
src/components/preview/ScrubbablePreview.tsx \
src/components/card/ExportCard.tsx \
src/components/card/ReviewCard.tsx \
src/components/card/AnimatedEventCard.tsx \
src/components/player/PreviewThumbnailPlayer.tsx \
src/views/system/StorageMetrics.tsx \
src/components/timeline/EventSegment.tsx \
--replace-fail "/media/frigate" "/var/lib/frigate" \
substituteInPlace src/views/system/StorageMetrics.tsx \
--replace-fail "/tmp/cache" "/var/cache/frigate"
'';
npmDepsHash = "sha256-CrK/6BaKmKIxlohEZdGEEKJkioszBUupyKQx4nBeLqI=";
installPhase = ''
cp -rv dist/ $out
'';
inherit (frigate) meta;
}