Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 128 lines 2.6 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 stdenvNoCC, 7 substituteAll, 8 9 # build 10 setuptools, 11 12 # propagates 13 aiohttp, 14 aiorun, 15 async-timeout, 16 coloredlogs, 17 orjson, 18 home-assistant-chip-clusters, 19 20 # optionals 21 cryptography, 22 home-assistant-chip-core, 23 zeroconf, 24 25 # tests 26 aioresponses, 27 python, 28 pytest, 29 pytest-aiohttp, 30 pytestCheckHook, 31}: 32 33let 34 paaCerts = stdenvNoCC.mkDerivation rec { 35 pname = "matter-server-paa-certificates"; 36 version = "1.3.0.0"; 37 38 src = fetchFromGitHub { 39 owner = "project-chip"; 40 repo = "connectedhomeip"; 41 rev = "refs/tags/v${version}"; 42 hash = "sha256-5MI6r0KhSTzolesTQ8YWeoko64jFu4jHfO5KOOKpV0A="; 43 }; 44 45 installPhase = '' 46 runHook preInstall 47 48 mkdir -p $out 49 cp $src/credentials/development/paa-root-certs/* $out/ 50 51 runHook postInstall 52 ''; 53 }; 54in 55 56buildPythonPackage rec { 57 pname = "python-matter-server"; 58 version = "6.6.0"; 59 pyproject = true; 60 61 disabled = pythonOlder "3.10"; 62 63 src = fetchFromGitHub { 64 owner = "home-assistant-libs"; 65 repo = "python-matter-server"; 66 rev = "refs/tags/${version}"; 67 hash = "sha256-g+97a/X0FSapMLfdW6iNf1akkHGLqCmHYimQU/M6loo="; 68 }; 69 70 patches = [ 71 (substituteAll { 72 src = ./link-paa-root-certs.patch; 73 paacerts = paaCerts; 74 }) 75 ]; 76 77 postPatch = '' 78 substituteInPlace pyproject.toml \ 79 --replace 'version = "0.0.0"' 'version = "${version}"' \ 80 --replace '--cov' "" 81 ''; 82 83 build-system = [ 84 setuptools 85 ]; 86 87 pythonRelaxDeps = [ "home-assistant-chip-clusters" ]; 88 89 dependencies = [ 90 aiohttp 91 aiorun 92 async-timeout 93 coloredlogs 94 orjson 95 home-assistant-chip-clusters 96 ]; 97 98 optional-dependencies = { 99 server = [ 100 cryptography 101 home-assistant-chip-core 102 zeroconf 103 ]; 104 }; 105 106 nativeCheckInputs = [ 107 aioresponses 108 pytest-aiohttp 109 pytestCheckHook 110 ] ++ lib.flatten (lib.attrValues optional-dependencies); 111 112 preCheck = 113 let 114 pythonEnv = python.withPackages (_: dependencies ++ nativeCheckInputs ++ [ pytest ]); 115 in 116 '' 117 export PYTHONPATH=${pythonEnv}/${python.sitePackages} 118 ''; 119 120 meta = with lib; { 121 changelog = "https://github.com/home-assistant-libs/python-matter-server/releases/tag/${version}"; 122 description = "Python server to interact with Matter"; 123 mainProgram = "matter-server"; 124 homepage = "https://github.com/home-assistant-libs/python-matter-server"; 125 license = licenses.asl20; 126 maintainers = teams.home-assistant.members; 127 }; 128}