diff --git a/pkgs/development/python-modules/pytraccar/default.nix b/pkgs/development/python-modules/pytraccar/default.nix new file mode 100644 index 000000000000..dd14bcfaadc0 --- /dev/null +++ b/pkgs/development/python-modules/pytraccar/default.nix @@ -0,0 +1,51 @@ +{ lib +, aiohttp +, aresponses +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, pytest-asyncio +, pythonOlder +}: + +buildPythonPackage rec { + pname = "pytraccar"; + version = "0.10.0"; + format = "setuptools"; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "ludeeus"; + repo = pname; + rev = version; + sha256 = "08f7rwvbc1h17lvgv9823ssd3p0vw7yzsg40lbkacgqqiv1hxfzs"; + }; + + propagatedBuildInputs = [ + aiohttp + ]; + + checkInputs = [ + aresponses + pytestCheckHook + pytest-asyncio + ]; + + postPatch = '' + # Upstream doesn't set version in the repo + substituteInPlace setup.py \ + --replace 'version="master",' 'version="${version}",' + ''; + + pythonImportsCheck = [ + "pytraccar" + ]; + + meta = with lib; { + description = "Python library to handle device information from Traccar"; + homepage = "https://github.com/ludeeus/pytraccar"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 609ef14c7e05..bbd9fb397305 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -890,7 +890,7 @@ "touchline" = ps: with ps; [ ]; # missing inputs: pytouchline "tplink" = ps: with ps; [ aiohttp-cors ifaddr python-kasa ]; "tplink_lte" = ps: with ps; [ ]; # missing inputs: tp-connected - "traccar" = ps: with ps; [ aiohttp-cors stringcase ]; # missing inputs: pytraccar + "traccar" = ps: with ps; [ aiohttp-cors pytraccar stringcase ]; "trace" = ps: with ps; [ ]; "tractive" = ps: with ps; [ aiotractive ]; "tradfri" = ps: with ps; [ pytradfri ]; diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index b6fd4b36b3ee..652b0f3d2bcc 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -662,6 +662,7 @@ in with py.pkgs; buildPythonApplication rec { "toon" "totalconnect" "tplink" + "traccar" "trace" "tradfri" "transmission" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2ad701030c27..cfb76788e836 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7720,6 +7720,8 @@ in { cudaSupport = false; }; + pytraccar = callPackage ../development/python-modules/pytraccar { }; + pytradfri = callPackage ../development/python-modules/pytradfri { }; pytrafikverket = callPackage ../development/python-modules/pytrafikverket { };