about summary refs log tree commit diff
path: root/pkgs/applications/video/frigate/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/video/frigate/default.nix')
-rw-r--r--pkgs/applications/video/frigate/default.nix57
1 files changed, 27 insertions, 30 deletions
diff --git a/pkgs/applications/video/frigate/default.nix b/pkgs/applications/video/frigate/default.nix
index 81798df47f27..6a93401d985d 100644
--- a/pkgs/applications/video/frigate/default.nix
+++ b/pkgs/applications/video/frigate/default.nix
@@ -3,20 +3,19 @@
 , python3
 , fetchFromGitHub
 , fetchurl
-, fetchpatch
 , frigate
 , nixosTests
 }:
 
 let
-  version = "0.12.1";
+  version = "0.13.1";
 
   src = fetchFromGitHub {
     #name = "frigate-${version}-source";
     owner = "blakeblackshear";
     repo = "frigate";
     rev = "refs/tags/v${version}";
-    hash = "sha256-kNvYsHoObi6b9KT/LYhTGK4uJ/uAHnYhyoQkiXIA/s8=";
+    hash = "sha256-2J7DhnYDX9ubbsk0qhji/vIKDouy9IqQztzbdPj2kxo=";
   };
 
   frigate-web = callPackage ./web.nix {
@@ -35,7 +34,7 @@ let
   };
 
   # Tensorflow Lite models
-  # https://github.com/blakeblackshear/frigate/blob/v0.12.0/Dockerfile#L88-L91
+  # https://github.com/blakeblackshear/frigate/blob/v0.13.0/docker/main/Dockerfile#L96-L97
   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=";
@@ -46,7 +45,7 @@ let
   };
 
   # OpenVino models
-  # https://github.com/blakeblackshear/frigate/blob/v0.12.0/Dockerfile#L92-L95
+  # https://github.com/blakeblackshear/frigate/blob/v0.13.0/docker/main/Dockerfile#L101
   openvino_model = fetchurl {
     url = "https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt";
     hash = "sha256-5Cj2vEiWR8Z9d2xBmVoLZuNRv4UOuxHSGZQWTJorXUQ=";
@@ -59,14 +58,6 @@ python.pkgs.buildPythonApplication rec {
 
   inherit src;
 
-  patches = [
-    (fetchpatch {
-      # numpy 1.24 compat
-      url = "https://github.com/blakeblackshear/frigate/commit/cb73d0cd392990448811c7212bc5f09be411fc69.patch";
-      hash = "sha256-Spt7eRosmTN8zyJ2uVme5HPVy2TKgBtvbQ6tp6PaNac=";
-    })
-  ];
-
   postPatch = ''
     echo 'VERSION = "${version}"' > frigate/version.py
 
@@ -75,58 +66,59 @@ python.pkgs.buildPythonApplication rec {
 
     substituteInPlace frigate/const.py \
       --replace "/media/frigate" "/var/lib/frigate" \
-      --replace "/tmp/cache" "/var/cache/frigate/"
+      --replace "/tmp/cache" "/var/cache/frigate" \
+      --replace "/config" "/var/lib/frigate" \
+      --replace "{CONFIG_DIR}/model_cache" "/var/cache/frigate/model_cache"
 
     substituteInPlace frigate/http.py \
-      --replace "/opt/frigate" "${placeholder "out"}/${python.sitePackages}" \
-      --replace "/tmp/cache/" "/var/cache/frigate/"
+      --replace "/opt/frigate" "${placeholder "out"}/${python.sitePackages}"
 
     substituteInPlace frigate/output.py \
       --replace "/opt/frigate" "${placeholder "out"}/${python.sitePackages}"
 
-    substituteInPlace frigate/record.py \
-      --replace "/tmp/cache" "/var/cache/frigate"
-
     substituteInPlace frigate/detectors/detector_config.py \
       --replace "/labelmap.txt" "${placeholder "out"}/share/frigate/labelmap.txt"
 
-    substituteInPlace frigate/detectors/plugins/edgetpu_tfl.py \
+    substituteInPlace frigate/config.py \
+      --replace "/cpu_model.tflite" "${tflite_cpu_model}" \
       --replace "/edgetpu_model.tflite" "${tflite_edgetpu_model}"
 
-    substituteInPlace frigate/detectors/plugins/cpu_tfl.py \
-      --replace "/cpu_model.tflite" "${tflite_cpu_model}"
-
-    substituteInPlace frigate/ffmpeg_presets.py --replace \
-       '"-timeout" if os.path.exists(BTBN_PATH) else "-stimeout"' \
-       '"-timeout"'
+    substituteInPlace frigate/test/test_config.py \
+      --replace "(MODEL_CACHE_DIR" "('/build/model_cache'" \
+      --replace "/config/model_cache" "/build/model_cache"
   '';
 
   dontBuild = true;
 
   propagatedBuildInputs = with python.pkgs; [
-    # requirements.txt
+    # docker/main/requirements.txt
     scikit-build
-    # requirements-wheel.txt
+    # docker/main/requirements-wheel.txt
     click
     flask
     imutils
     matplotlib
+    norfair
     numpy
+    onvif-zeep
     opencv4
     openvino
     paho-mqtt
     peewee
     peewee-migrate
     psutil
+    py3nvml
     pydantic
+    pytz
     pyyaml
     requests
+    ruamel-yaml
     scipy
     setproctitle
     tensorflow
     tzlocal
+    unidecode
     ws4py
-    zeroconf
   ];
 
   installPhase = ''
@@ -144,10 +136,15 @@ python.pkgs.buildPythonApplication rec {
     runHook postInstall
   '';
 
-  checkInputs = with python.pkgs; [
+  nativeCheckInputs = with python.pkgs; [
     pytestCheckHook
   ];
 
+  disabledTests = [
+    # Test needs network access
+    "test_plus_labelmap"
+  ];
+
   passthru = {
     web = frigate-web;
     inherit python;