2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
2024-04-21 15:54:59 +00:00
|
|
|
, stdenvNoCC
|
|
|
|
, substituteAll
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
# build
|
|
|
|
, setuptools
|
2024-02-29 20:09:43 +00:00
|
|
|
, pythonRelaxDepsHook
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
# propagates
|
|
|
|
, aiohttp
|
|
|
|
, aiorun
|
2024-01-02 11:29:13 +00:00
|
|
|
, async-timeout
|
2023-01-20 10:41:00 +00:00
|
|
|
, coloredlogs
|
|
|
|
, dacite
|
|
|
|
, orjson
|
|
|
|
, home-assistant-chip-clusters
|
|
|
|
|
|
|
|
# optionals
|
2023-04-12 12:48:02 +00:00
|
|
|
, cryptography
|
2023-01-20 10:41:00 +00:00
|
|
|
, home-assistant-chip-core
|
2024-02-29 20:09:43 +00:00
|
|
|
, zeroconf
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
# tests
|
|
|
|
, python
|
|
|
|
, pytest
|
|
|
|
, pytest-aiohttp
|
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
let
|
|
|
|
paaCerts = stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "matter-server-paa-certificates";
|
|
|
|
version = "1.2.0.1";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "project-chip";
|
|
|
|
repo = "connectedhomeip";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-p3P0n5oKRasYz386K2bhN3QVfN6oFndFIUWLEUWB0ss=";
|
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp $src/credentials/development/paa-root-certs/* $out/
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-matter-server";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "5.9.0";
|
2023-01-20 10:41:00 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
disabled = pythonOlder "3.10";
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant-libs";
|
|
|
|
repo = "python-matter-server";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-O3AJ7vBjuwRGa4AMwWIdxn5m2F45rLCjCHeff18b/5E=";
|
2023-01-20 10:41:00 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./link-paa-root-certs.patch;
|
|
|
|
paacerts = paaCerts;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-02-29 20:09:43 +00:00
|
|
|
--replace 'version = "0.0.0"' 'version = "${version}"' \
|
|
|
|
--replace '--cov' ""
|
2024-01-02 11:29:13 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
2024-02-29 20:09:43 +00:00
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonRelaxDeps = [
|
|
|
|
"home-assistant-chip-clusters"
|
2023-01-20 10:41:00 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
aiorun
|
2024-01-02 11:29:13 +00:00
|
|
|
async-timeout
|
2023-01-20 10:41:00 +00:00
|
|
|
coloredlogs
|
|
|
|
dacite
|
|
|
|
orjson
|
|
|
|
home-assistant-chip-clusters
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
|
|
|
server = [
|
2023-04-12 12:48:02 +00:00
|
|
|
cryptography
|
2023-01-20 10:41:00 +00:00
|
|
|
home-assistant-chip-core
|
2024-02-29 20:09:43 +00:00
|
|
|
zeroconf
|
2023-01-20 10:41:00 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-01-20 10:41:00 +00:00
|
|
|
pytest-aiohttp
|
|
|
|
pytestCheckHook
|
|
|
|
]
|
2024-02-29 20:09:43 +00:00
|
|
|
++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
preCheck = let
|
2023-02-02 18:25:31 +00:00
|
|
|
pythonEnv = python.withPackages (_: propagatedBuildInputs ++ nativeCheckInputs ++ [ pytest ]);
|
2023-01-20 10:41:00 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
export PYTHONPATH=${pythonEnv}/${python.sitePackages}
|
|
|
|
'';
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# Upstream theymselves limit the test scope
|
|
|
|
# https://github.com/home-assistant-libs/python-matter-server/blob/main/.github/workflows/test.yml#L65
|
|
|
|
"tests/server"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
changelog = "https://github.com/home-assistant-libs/python-matter-server/releases/tag/${version}";
|
|
|
|
description = "Python server to interact with Matter";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "matter-server";
|
2023-01-20 10:41:00 +00:00
|
|
|
homepage = "https://github.com/home-assistant-libs/python-matter-server";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = teams.home-assistant.members;
|
|
|
|
};
|
|
|
|
}
|