nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at haskell-updates 298 lines 8.2 kB view raw
1{ 2 aiohttp, 3 alive-progress, 4 build, 5 clang-tools, 6 click, 7 colorama, 8 coloredlogs, 9 cryptography, 10 debugpy, 11 diskcache, 12 fetchFromGitHub, 13 fetchpatch, 14 glib, 15 gn, 16 googleapis-common-protos, 17 ipython, 18 jinja2, 19 json5, 20 jsonschema, 21 lark, 22 lib, 23 libnl, 24 mobly, 25 mypy, 26 mypy-protobuf, 27 ninja, 28 openssl, 29 packaging, 30 parameterized, 31 pip-tools, 32 pkg-config, 33 pkgconfig, 34 prompt-toolkit, 35 protobuf, 36 psutil, 37 ptpython, 38 pyelftools, 39 pyfakefs, 40 pygments, 41 pykwalify, 42 pyperclip, 43 pyserial, 44 python, 45 python-daemon, 46 python-path, 47 pyyaml, 48 requests, 49 setuptools, 50 six, 51 sphinx, 52 sphinx-argparse, 53 sphinx-design, 54 stdenv, 55 tabulate, 56 tomli, 57 tornado, 58 types-pyyaml, 59 types-requests, 60 watchdog, 61 websockets, 62 zap-chip, 63}: 64 65stdenv.mkDerivation rec { 66 pname = "home-assistant-chip-wheels"; 67 version = "2025.7.0"; 68 69 src = fetchFromGitHub { 70 owner = "home-assistant-libs"; 71 repo = "chip-wheels"; 72 tag = version; 73 fetchSubmodules = false; 74 leaveDotGit = true; 75 hash = "sha256-SfhsM2RPghFPx0qtoHsXVymwmOWFiEGAyLx6FeB++dg="; 76 postFetch = '' 77 cd $out 78 # Download connectedhomeip. 79 git fetch 80 git reset --hard HEAD 81 git submodule update --init --depth 1 connectedhomeip 82 83 # Initialize only necessary submodules. 84 cd connectedhomeip 85 ${python.interpreter} scripts/checkout_submodules.py --platform linux --shallow 86 87 # Keep the output deterministic. 88 cd $out 89 # in case python decided to leave a .pyc file, for example 90 git clean -fxd 91 rm -rf .git/ 92 ''; 93 }; 94 95 strictDeps = true; 96 97 nativeBuildInputs = [ 98 gn 99 pkg-config 100 ninja 101 clang-tools 102 zap-chip 103 # gdbus-codegen 104 glib 105 pkgconfig 106 python 107 # dependencies of build scripts 108 click 109 jinja2 110 lark 111 python-path 112 setuptools 113 build 114 pip-tools 115 ]; 116 117 propagatedBuildInputs = [ 118 openssl 119 glib 120 libnl 121 ]; 122 123 patches = [ 124 (fetchpatch { 125 # Fix building with newer gn version 126 name = "pw_protobuf_compiler-Create-a-new-includes.txt-for-each-toolchain.patch"; 127 # https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/300272 128 url = "https://pigweed.googlesource.com/pigweed/pigweed/+/b66729b90fcb9df2ee4818f6d4fff59385cdbc80^!?format=TEXT"; 129 decode = "base64 -d"; 130 stripLen = 1; 131 extraPrefix = "connectedhomeip/third_party/pigweed/repo/"; 132 hash = "sha256-6ss3j8j69w7EMio9mFP/EL2oPqQ2sLh67eWsJjHdDa8="; 133 }) 134 # fix `ModuleNotFoundError: No module named 'matter'` 135 # https://github.com/project-chip/connectedhomeip/pull/39826 136 (fetchpatch { 137 url = "https://github.com/project-chip/connectedhomeip/commit/78c6a7e15658f66658eb9f780e1a0c0c176a67d7.patch"; 138 stripLen = 1; 139 extraPrefix = "connectedhomeip/"; 140 hash = "sha256-s5t9DvmZVpnVelrN9+Ekn0OJl/VouXUGKCgu/PTLHBI="; 141 }) 142 ]; 143 144 postPatch = '' 145 cd connectedhomeip 146 export HOME=$(mktemp -d) 147 148 patchShebangs --build scripts 149 150 for patch in ../*.patch; do 151 patch -p1 < $patch 152 done 153 154 # ecdsa is insecure and only used in tests 155 patch -p1 < ${./dont-import-ecdsa.patch} 156 157 # unpin dependencies 158 # there are many files to modify, in different formats 159 sed -i 's/==.*$//' third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/python_base_requirements.txt 160 sed -i 's/==[^;]*//' scripts/setup/constraints.txt scripts/tests/requirements.txt 161 sed -i 's/\(^ \+[a-zA-Z0-9-]*\)[=~><]=[^;]*/\1/' third_party/pigweed/repo/pw_protobuf_compiler/py/setup.cfg third_party/pigweed/repo/pw_protobuf/py/setup.cfg third_party/pigweed/repo/pw_protobuf_compiler/py/setup.cfg 162 # remove a few dependencies not packaged in nixpkgs and which are apparently 163 # not needed to build the python bindings of chip 164 sed -i -e '/sphinxcontrib-mermaid/d' -e '/types-six/d' -e '/types-pygment/d' -e '/types-pyserial/d' third_party/pigweed/repo/*/py/setup.cfg 165 166 # obtained by running a build in nix-shell with internet access 167 cp ${./pigweed_environment.gni} build_overrides/pigweed_environment.gni 168 169 # some code is generated by a templating tool (zap-cli) 170 scripts/codepregen.py ./zzz_pregenerated/ 171 172 # `pip._internal.exceptions.InstallationError: ''${PW_PROJECT_ROOT}/scripts/py_matter_idl is not a valid editable requirement` 173 substituteInPlace scripts/tests/requirements.txt \ 174 --replace-fail '-e ''${PW_PROJECT_ROOT}/scripts/py_matter_idl' "" \ 175 --replace-fail '-e ''${PW_PROJECT_ROOT}/scripts/py_matter_yamltests' "" 176 ''; 177 178 # the python parts of the build system work as follows 179 # gn calls pigweed to read a dozen different files to generate 180 # a file looking like requirements.txt. It then calls pip 181 # to install this computed list of dependencies into a virtualenv. 182 # Of course, pip fails in the sandbox, because it cannot download 183 # the python packages. 184 # The documented way of doing offline builds is to create a folder 185 # with wheel files for all dependencies and point pip to it 186 # via its configuration file or environment variables. 187 # https://pigweed.dev/python_build.html#installing-offline 188 # The wheel of a python package foo is available as foo.dist. 189 # So that would be easy, but we also need wheels for transitive dependencies. 190 # the function saturateDependencies below computes this transitive closure. 191 # 192 # yes this list of dependencies contains both build tools and proper dependencies. 193 env.PIP_NO_INDEX = "1"; 194 env.PIP_FIND_LINKS = 195 let 196 dependencies = [ 197 aiohttp 198 alive-progress 199 colorama 200 coloredlogs 201 click 202 cryptography 203 debugpy 204 diskcache 205 googleapis-common-protos 206 ipython 207 jinja2 208 json5 209 jsonschema 210 lark 211 mobly 212 mypy 213 mypy-protobuf 214 packaging 215 parameterized 216 pkgconfig 217 prompt-toolkit 218 protobuf 219 psutil 220 ptpython 221 pyfakefs 222 pyelftools 223 pygments 224 pykwalify 225 pyperclip 226 pyserial 227 python-daemon 228 python-path 229 pyyaml 230 requests 231 six 232 sphinx 233 sphinx-argparse 234 sphinx-design 235 tabulate 236 tomli 237 tornado 238 types-pyyaml 239 types-requests 240 watchdog 241 websockets 242 ]; 243 filterNull = list: lib.filter (dep: dep != null) list; 244 toItem = dep: { 245 inherit dep; 246 key = dep.name; 247 }; 248 saturatedDependencies = lib.genericClosure { 249 startSet = map toItem (filterNull dependencies); 250 operator = item: map toItem (filterNull ((item.dep).propagatedBuildInputs or [ ])); 251 }; 252 saturatedDependencyList = lib.filter (dep: dep ? dist && dep != null) ( 253 map (item: item.dep) saturatedDependencies 254 ); 255 in 256 lib.concatMapStringsSep " " (dep: "file://${dep.dist}") saturatedDependencyList; 257 258 gnFlags = [ 259 ''chip_project_config_include_dirs=["//.."]'' 260 ''chip_crypto="openssl"'' 261 "enable_rtti=true" 262 "chip_config_memory_debug_checks=false" 263 "chip_config_memory_debug_dmalloc=false" 264 ''chip_mdns="minimal"'' 265 ''chip_minmdns_default_policy="libnl"'' 266 ''chip_python_version="${version}"'' 267 ''chip_python_platform_tag="any"'' 268 ''chip_python_package_prefix="home-assistant-chip"'' 269 ''custom_toolchain="custom"'' 270 ''target_cc="${stdenv.cc.targetPrefix}cc"'' 271 ''target_cxx="${stdenv.cc.targetPrefix}c++"'' 272 ''target_ar="${stdenv.cc.targetPrefix}ar"'' 273 ]; 274 275 preBuild = '' 276 export NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags glib-2.0) -O2 -Wno-error" 277 export NIX_CFLAGS_LINK="$($PKG_CONFIG --libs gio-2.0) $($PKG_CONFIG --libs gobject-2.0) $($PKG_CONFIG --libs glib-2.0)" 278 ''; 279 280 ninjaFlags = [ "chip-repl" ]; 281 282 installPhase = '' 283 runHook preInstall 284 285 cp -r controller/python $out 286 287 runHook postInstall 288 ''; 289 290 meta = { 291 description = "Python wheels for APIs and tools related to CHIP"; 292 homepage = "https://github.com/home-assistant-libs/chip-wheels"; 293 changelog = "https://github.com/home-assistant-libs/chip-wheels/releases/tag/${src.tag}"; 294 license = lib.licenses.asl20; 295 teams = [ lib.teams.home-assistant ]; 296 }; 297 298}