diff --git a/pkgs/applications/backup/unifi-protect-backup/default.nix b/pkgs/applications/backup/unifi-protect-backup/default.nix index fdac36e492f2..1ffdeca5b38d 100644 --- a/pkgs/applications/backup/unifi-protect-backup/default.nix +++ b/pkgs/applications/backup/unifi-protect-backup/default.nix @@ -1,25 +1,11 @@ -{ lib -, fetchFromGitHub -, python3 +{ + lib, + fetchFromGitHub, + fetchpatch, + python3, }: -let - python = python3.override { - packageOverrides = self: super: { - pyunifiprotect = super.pyunifiprotect.overridePythonAttrs { - version = "unstable-2024-06-08"; - src = fetchFromGitHub { - owner = "ep1cman"; - repo = "pyunifiprotect"; - rev = "d967bca2c65e0aa6a7363afb6367c3745c076747"; - hash = "sha256-gSAK/T9cjIiRC/WjwrdLP+LHzEEUsNbwpXClYqpnMio="; - }; - }; - }; - }; -in - -python.pkgs.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "unifi-protect-backup"; version = "0.11.0"; pyproject = true; @@ -31,18 +17,25 @@ python.pkgs.buildPythonApplication rec { hash = "sha256-t4AgPFqKS6u9yITIkUUB19/SxVwR7X8Cc01oPx3M+E0="; }; + patches = [ + # Switch to using UIProtect library, https://github.com/ep1cman/unifi-protect-backup/pull/160 + (fetchpatch { + name = "switch-uiprotect.patch"; + url = "https://github.com/ep1cman/unifi-protect-backup/commit/ccf2cde27229ade5c70ebfa902f289bf1a439f64.patch"; + hash = "sha256-kogl/crvLE+7t9DLTuZqeW3/WB5/sytWDgbndoBw+RQ="; + }) + ]; + pythonRelaxDeps = [ "aiorun" "aiosqlite" "click" - "pyunifiprotect" + "uiprotect" ]; - nativeBuildInputs = with python.pkgs; [ - poetry-core - ]; + nativeBuildInputs = with python3.pkgs; [ poetry-core ]; - propagatedBuildInputs = with python.pkgs; [ + propagatedBuildInputs = with python3.pkgs; [ aiocron aiolimiter aiorun @@ -52,12 +45,10 @@ python.pkgs.buildPythonApplication rec { click expiring-dict python-dateutil - pyunifiprotect + uiprotect ]; - nativeCheckInputs = with python.pkgs; [ - pytestCheckHook - ]; + nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ]; meta = with lib; { description = "Python tool to backup unifi event clips in realtime"; diff --git a/pkgs/development/python-modules/pyunifiprotect/default.nix b/pkgs/development/python-modules/pyunifiprotect/default.nix deleted file mode 100644 index bfbd39ce5cc4..000000000000 --- a/pkgs/development/python-modules/pyunifiprotect/default.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ - lib, - aiofiles, - aiohttp, - aioshutil, - async-timeout, - buildPythonPackage, - dateparser, - fetchFromGitHub, - ffmpeg, - hatch-vcs, - hatchling, - ipython, - orjson, - packaging, - pillow, - platformdirs, - py, - pydantic, - pyjwt, - pytest-aiohttp, - pytest-asyncio, - pytest-benchmark, - pytest-timeout, - pytest-xdist, - pytestCheckHook, - python-dotenv, - pythonOlder, - pytz, - termcolor, - typer, -}: - -buildPythonPackage rec { - pname = "pyunifiprotect"; - version = "5.1.2"; - pyproject = true; - - disabled = pythonOlder "3.9"; - - src = fetchFromGitHub { - owner = "briis"; - repo = "pyunifiprotect"; - rev = "refs/tags/v${version}"; - hash = "sha256-DtQm6u3O0kdVJ23Ch+hJQ6HTOt5iAMdhCzC1K/oICWk="; - }; - - env.SETUPTOOLS_SCM_PRETEND_VERSION = version; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace-fail "--strict-markers -ra -Wd --ignore=.* --no-cov-on-fail --cov=pyunifiprotect --cov-append --maxfail=10 -n=auto" "" - ''; - - build-system = [ - hatch-vcs - hatchling - ]; - - dependencies = [ - aiofiles - aiohttp - aioshutil - dateparser - orjson - packaging - pillow - platformdirs - pydantic - pyjwt - pytz - typer - ] ++ lib.optionals (pythonOlder "3.11") [ async-timeout ]; - - passthru.optional-dependencies = { - shell = [ - ipython - python-dotenv - termcolor - ]; - }; - - nativeCheckInputs = [ - ffmpeg # Required for command ffprobe - py - pytest-aiohttp - pytest-asyncio - pytest-benchmark - pytest-timeout - pytest-xdist - pytestCheckHook - ]; - - pythonImportsCheck = [ "pyunifiprotect" ]; - - pytestFlagsArray = [ "--benchmark-disable" ]; - - meta = with lib; { - description = "Library for interacting with the Unifi Protect API"; - mainProgram = "unifi-protect"; - homepage = "https://github.com/briis/pyunifiprotect"; - changelog = "https://github.com/AngellusMortis/pyunifiprotect/releases/tag/v${version}"; - license = with licenses; [ mit ]; - maintainers = with maintainers; [ fab ]; - }; -} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 9fd21df75e73..9c26e747a421 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -518,6 +518,7 @@ mapAliases ({ pytorchWithoutCuda = torchWithoutCuda; # added 2022-09-30 pytwitchapi = twitchapi; # added 2022-03-07 pyuavcan = throw "pyuavcan has been renamed to pycyphal and the old package deprecated, use pycyphal instead"; # added 2024-02-09 + pyunifiprotect = throw "pyunifiprotect has disappeared from GitHub and PyPI, use uiprotect instead"; # added 2024-09-17 pyutilib = throw "pyutilib has been removed, since it is no longer maintained"; # added 2024-07-28 pyvcf = throw "pyvcf has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2023-05-19 pyvicare = pyvicare-neo; # added 2024-08-31 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 584ca15af3d4..a6db98bd998e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13005,8 +13005,6 @@ self: super: with self; { pyunifi = callPackage ../development/python-modules/pyunifi { }; - pyunifiprotect = callPackage ../development/python-modules/pyunifiprotect { }; - pyupdate = callPackage ../development/python-modules/pyupdate { }; pyupgrade = callPackage ../development/python-modules/pyupgrade { };