Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 136 lines 2.7 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 stdenvNoCC, 7 replaceVars, 8 9 # build 10 setuptools, 11 12 # dependencies 13 aiohttp, 14 aiorun, 15 async-timeout, 16 atomicwrites, 17 coloredlogs, 18 orjson, 19 home-assistant-chip-clusters, 20 21 # optionals 22 cryptography, 23 home-assistant-chip-core, 24 zeroconf, 25 26 # tests 27 aioresponses, 28 python, 29 pytest, 30 pytest-aiohttp, 31 pytest-cov-stub, 32 pytestCheckHook, 33}: 34 35let 36 paaCerts = stdenvNoCC.mkDerivation rec { 37 pname = "matter-server-paa-certificates"; 38 version = "1.4.0.0"; 39 40 src = fetchFromGitHub { 41 owner = "project-chip"; 42 repo = "connectedhomeip"; 43 rev = "refs/tags/v${version}"; 44 hash = "sha256-uJyStkwynPCm1B2ZdnDC6IAGlh+BKGfJW7tU4tULHFo="; 45 }; 46 47 installPhase = '' 48 runHook preInstall 49 50 mkdir -p $out 51 cp $src/credentials/development/paa-root-certs/* $out/ 52 53 runHook postInstall 54 ''; 55 }; 56in 57 58buildPythonPackage rec { 59 pname = "python-matter-server"; 60 version = "8.0.0"; 61 pyproject = true; 62 63 disabled = pythonOlder "3.12"; 64 65 src = fetchFromGitHub { 66 owner = "home-assistant-libs"; 67 repo = "python-matter-server"; 68 tag = version; 69 hash = "sha256-9dMcofwvGYBnI+9y7D+TDwz+uLgBVhcS4iVU7AUqclI="; 70 }; 71 72 patches = [ 73 (replaceVars ./link-paa-root-certs.patch { 74 paacerts = paaCerts; 75 }) 76 ]; 77 78 postPatch = '' 79 substituteInPlace pyproject.toml \ 80 --replace-fail 'version = "0.0.0"' 'version = "${version}"' 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 atomicwrites 94 coloredlogs 95 orjson 96 home-assistant-chip-clusters 97 ]; 98 99 optional-dependencies = { 100 server = [ 101 cryptography 102 home-assistant-chip-core 103 zeroconf 104 ]; 105 }; 106 107 nativeCheckInputs = [ 108 aioresponses 109 pytest-aiohttp 110 pytest-cov-stub 111 pytestCheckHook 112 ] 113 ++ lib.flatten (lib.attrValues optional-dependencies); 114 115 preCheck = 116 let 117 pythonEnv = python.withPackages (_: dependencies ++ nativeCheckInputs ++ [ pytest ]); 118 in 119 '' 120 export PYTHONPATH=${pythonEnv}/${python.sitePackages} 121 ''; 122 123 disabledTestPaths = [ 124 # requires internet access 125 "tests/server/ota/test_dcl.py" 126 ]; 127 128 meta = { 129 changelog = "https://github.com/home-assistant-libs/python-matter-server/releases/tag/${src.tag}"; 130 description = "Python server to interact with Matter"; 131 mainProgram = "matter-server"; 132 homepage = "https://github.com/home-assistant-libs/python-matter-server"; 133 license = lib.licenses.asl20; 134 teams = [ lib.teams.home-assistant ]; 135 }; 136}