2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
stdenvNoCC,
|
|
|
|
substituteAll,
|
|
|
|
|
|
|
|
# build
|
|
|
|
setuptools,
|
|
|
|
|
|
|
|
# propagates
|
|
|
|
aiohttp,
|
|
|
|
aiorun,
|
|
|
|
async-timeout,
|
|
|
|
coloredlogs,
|
|
|
|
dacite,
|
|
|
|
orjson,
|
|
|
|
home-assistant-chip-clusters,
|
|
|
|
|
|
|
|
# optionals
|
|
|
|
cryptography,
|
|
|
|
home-assistant-chip-core,
|
|
|
|
zeroconf,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
python,
|
|
|
|
pytest,
|
|
|
|
pytest-aiohttp,
|
|
|
|
pytestCheckHook,
|
2023-01-20 10:41:00 +00:00
|
|
|
}:
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
let
|
|
|
|
paaCerts = stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "matter-server-paa-certificates";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "1.3.0.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "project-chip";
|
|
|
|
repo = "connectedhomeip";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-5MI6r0KhSTzolesTQ8YWeoko64jFu4jHfO5KOOKpV0A=";
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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-09-19 14:19:46 +00:00
|
|
|
version = "6.3.0";
|
2024-06-20 14:57:18 +00:00
|
|
|
pyproject = true;
|
2023-01-20 10:41:00 +00:00
|
|
|
|
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-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-/e7U0knkWQq9PnTimA2/ncNTyekx7QOcFEdtJHUcb9I=";
|
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
|
|
|
'';
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
build-system = [
|
2023-01-20 10:41:00 +00:00
|
|
|
setuptools
|
2024-02-29 20:09:43 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonRelaxDeps = [ "home-assistant-chip-clusters" ];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
dependencies = [
|
2023-01-20 10:41:00 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
optional-dependencies = {
|
2023-01-20 10:41:00 +00:00
|
|
|
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-06-20 14:57:18 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
preCheck =
|
|
|
|
let
|
2024-06-20 14:57:18 +00:00
|
|
|
pythonEnv = python.withPackages (_: dependencies ++ nativeCheckInputs ++ [ pytest ]);
|
2024-06-05 15:53:02 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
export PYTHONPATH=${pythonEnv}/${python.sitePackages}
|
|
|
|
'';
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|