From a3d12aeef9f5b5dfe7e8de9ea4e5adc829810454 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Fri, 26 Apr 2024 19:30:10 +0100 Subject: [PATCH] nix/pkgs/home-assistant-chip: drop this again, it's annoying to maintain :/ --- nix/pkgs/default.nix | 3 - .../compiled_requirements.txt | 108 ------ nix/pkgs/home-assistant-chip/default.nix | 362 ------------------ nix/pkgs/zcl-advanced-platform/default.nix | 32 -- third_party/default.nix | 12 - 5 files changed, 517 deletions(-) delete mode 100644 nix/pkgs/home-assistant-chip/compiled_requirements.txt delete mode 100644 nix/pkgs/home-assistant-chip/default.nix delete mode 100644 nix/pkgs/zcl-advanced-platform/default.nix diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 3ada5289d8..6d3291d41b 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -83,8 +83,5 @@ freeswitch-sounds = pkgs.callPackage ./freeswitch-sounds.nix { }; - zcl-advanced-platform = pkgs.callPackage ./zcl-advanced-platform { }; - home-assistant-chip = pkgs.python3.pkgs.callPackage ./home-assistant-chip { inherit zcl-advanced-platform; gn = pkgs.gn1924; }; - lukegb-vscode = pkgs.vscode; } // (import ./heptapod-runner args) diff --git a/nix/pkgs/home-assistant-chip/compiled_requirements.txt b/nix/pkgs/home-assistant-chip/compiled_requirements.txt deleted file mode 100644 index 8354959e66..0000000000 --- a/nix/pkgs/home-assistant-chip/compiled_requirements.txt +++ /dev/null @@ -1,108 +0,0 @@ -alabaster==0.7.13 -appdirs==1.4.4 -astroid==3.0.2 -asttokens==2.2.1 -babel==2.14.0 -backcall==0.2.0 -black==23.12.1 -build==0.8.0 -cachetools==5.3.2 -certifi==2022.12.7 -cffi==1.15.1 -charset-normalizer==3.0.1 -click==8.1.3 -coloredlogs==15.0.1 -coverage==7.4.0 -cryptography==39.0.2 -decorator==5.1.1 -dill==0.3.7 -diskcache==5.4.0 -docutils==0.20.1 -executing==1.2.0 -google-api-core==2.15.0 -google-auth==2.26.1 -google-cloud-core==2.4.1 -google-cloud-storage==2.14.0 -google-crc32c==1.5.0 -google-resumable-media==2.7.0 -googleapis-common-protos==1.62.0 -humanfriendly==10.0 -idna==3.4 -imagesize==1.4.1 -ipython==8.11.0 -isort==5.13.2 -jedi==0.18.2 -jinja2==3.0.3 -json5==0.9.14 -lark==1.1.5 -lockfile==0.12.2 -markupsafe==2.1.2 -matplotlib-inline==0.1.6 -mccabe==0.7.0 -mobly==1.12.1 -mypy==0.971 -mypy-extensions==1.0.0 -mypy-protobuf==3.5.0 -packaging==23.0 -parameterized==0.9.0 -parso==0.8.3 -pathspec==0.12.1 -pep517==0.13.0 -pexpect==4.8.0 -pickleshare==0.7.5 -pip-tools==7.0.0 -platformdirs==3.0.0 -portpicker==1.5.2 -prompt-toolkit==3.0.43 -protobuf==4.24.4 -psutil==5.9.4 -ptpython==3.0.25 -ptyprocess==0.7.0 -pure-eval==0.2.2 -pyasn1==0.5.1 -pyasn1-modules==0.3.0 -pycparser==2.21 -pyelftools==0.30 -pygments==2.14.0 -pylint==3.0.3 -pyperclip==1.8.2 -pyserial==3.5 -python-daemon==3.0.1 -pyyaml==6.0 -requests==2.28.2 -rsa==4.9 -six==1.16.0 -snowballstemmer==2.2.0 -sphinx==7.2.6 -sphinx-argparse==0.4.0 -sphinx-design==0.5.0 -sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-devhelp==1.0.5 -sphinxcontrib-htmlhelp==2.0.4 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-mermaid==0.9.2 -sphinxcontrib-qthelp==1.0.6 -sphinxcontrib-serializinghtml==1.1.9 -stack-data==0.6.2 -stringcase==1.2.0 -toml==0.10.2 -tomlkit==0.12.3 -traitlets==5.9.0 -types-docutils==0.20.0.20240106 -types-protobuf==4.24.0.2 -types-pygments==2.17.0.20240106 -types-pyserial==3.5.0.20240106 -types-pyyaml==6.0.12.12 -types-requests==2.31.0.6 -types-setuptools==69.0.0.20240106 -types-six==1.16.21.20240106 -types-urllib3==1.26.25.14 -typing-extensions==4.5.0 -urllib3==1.26.14 -watchdog==2.3.1 -wcwidth==0.2.6 -websockets==10.4 -wheel==0.38.4 ; sys_platform == "linux" -yapf==0.32.0 -pip==23.2.1 -setuptools==68.0.0 diff --git a/nix/pkgs/home-assistant-chip/default.nix b/nix/pkgs/home-assistant-chip/default.nix deleted file mode 100644 index 0ce706620c..0000000000 --- a/nix/pkgs/home-assistant-chip/default.nix +++ /dev/null @@ -1,362 +0,0 @@ -{ lib -, stdenv -, buildPythonPackage -, fetchFromGitHub -, pythonOlder -, runCommand -, python -, git -, zcl-advanced-platform -, click -, setuptools -, lark -, jinja2 -, stringcase -, clang-tools -, gn -, pkg-config -, libnl -, openssl -, glib -, ninja -, pyproject-hooks -, cython_0 -, autoPatchelfHook - -, aenum -, coloredlogs -, construct -, cryptography -, dacite -, ecdsa -, rich -, pyyaml -, ipdb -, deprecation -, mobly -, pygobject3 - -, ipython -, dbus-python -}: - -let - matterVersion = "1.2.0.1"; # check matter_sdk_ref in https://github.com/home-assistant-libs/chip-wheels/blob/main/.github/workflows/build.yaml - matterSDKSrc = (fetchFromGitHub { - owner = "project-chip"; - repo = "connectedhomeip"; - rev = "v${matterVersion}"; - hash = "sha256-CSOeTd0A95nePjrceCyVntRn36dz2q8Z9b8l2ehxBOQ="; - forceFetchGit = true; - }).overrideAttrs (old: { - # Checkout submodules before .git directories are removed. - nativeBuildInputs = old.nativeBuildInputs ++ [ - python - ]; - env.NIX_PREFETCH_GIT_CHECKOUT_HOOK = '' - python $dir/scripts/checkout_submodules.py --shallow --platform linux - ''; - }); - - zapPregenerated = stdenv.mkDerivation rec { - pname = "matter-sdk-zap"; - version = matterVersion; - - src = matterSDKSrc; - - nativeBuildInputs = [ - python - - click - lark - jinja2 - stringcase - - zcl-advanced-platform # zap-cli - clang-tools # clang-format - ]; - - postPatch = '' - patchShebangs --build scripts - ''; - - buildPhase = '' - runHook preBuild - # Generate ZAP code - python scripts/codepregen.py $out - runHook postBuild - ''; - }; - - baseline = rec { - pname = "home-assistant-chip"; - version = "2023.12.0"; - pyproject = false; - - disabled = pythonOlder "3.7"; - - src = fetchFromGitHub { - owner = "home-assistant-libs"; - repo = "chip-wheels"; - rev = version; - hash = "sha256-/FUyP+DASaXSRFWuSnhSv+kWFR2bQATJr7QdeMV6kdg="; - }; - - inherit matterSDKSrc zapPregenerated; - - prePatch = '' - cp -R $matterSDKSrc project-chip - chmod -R +w project-chip - ''; - - postPatch = '' - pushd project-chip - rm ../*-Use-data-as-platform-storage-location.patch - for patch in ../*.patch; do - patch -p1 < "$patch" - done - patchShebangs --build scripts - sed -i 's,[>=]=[0-9][^;]*,,g' \ - third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/python_base_requirements.txt - popd - ''; - - buildInputs = [ - libnl - openssl - glib - ]; - - nativeBuildInputs = [ - gn # gn - ninja # ninja - pkg-config # pkg-config - ]; - - gnArgs = []; - - configurePhase = '' - runHook preConfigure - - pushd project-chip - - # Empty pigweed_environment - echo "# Empty pigweed environment" > build_overrides/pigweed_environment.gni - - # Generate gn build scripts - gn gen --check --fail-on-unused-args out --args=" \ - enable_rtti=true \ - enable_pylib=true \ - chip_config_memory_debug_checks=false \ - chip_config_memory_debug_dmalloc=false \ - chip_mdns=\"minimal\" \ - chip_minmdns_default_policy=\"libnl\" \ - chip_python_version=\"${version}\" \ - chip_python_package_prefix=\"home-assistant-chip\" \ - chip_python_platform_tag=\"manylinux_2_31\" \ - chip_code_pre_generated_directory=\"$zapPregenerated\" \ - $gnArgs - " - - popd - - runHook postConfigure - ''; - }; - - src-wheels = stdenv.mkDerivation (baseline // { - pname = "${baseline.pname}-src-wheels"; - - gnArgs = [ - ''pw_build_PIP_CONSTRAINTS=["//scripts/setup/constraints.txt","//extra_constraints.txt"]'' - ]; - - preConfigure = '' - cp ${./compiled_requirements.txt} project-chip/extra_constraints.txt - ''; - - buildPhase = '' - runHook preBuild - - pushd project-chip - - export HOME=$NIX_BUILD_TOP/home - mkdir $HOME - ninja -C out $(gn ls out --as=output '//:matter_build_venv.vendor_wheels') - - popd - - runHook postBuild - ''; - - nativeBuildInputs = baseline.nativeBuildInputs ++ [ - setuptools - ]; - - installPhase = '' - runHook preInstall - - mkdir $out - cp -R ./project-chip/out/python/gen/matter_build_venv.vendor_wheels/wheels $out/wheels - sed -e 's/#.*//g' -e '/^\s*$/d' project-chip/out/python/gen/matter_build_venv/compiled_requirements.txt > $out/compiled_requirements.txt - - runHook postInstall - ''; - - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; - outputHash = "sha256:11c0v6yc4wxnbkvya0jjf51rpbdfa9dk372ci46mhf0yzb7j5icz"; - }); - - out-wheels = stdenv.mkDerivation (baseline // { - pname = "${baseline.pname}-wheels"; - - env.NIX_CFLAGS_COMPILE = "-Wno-error=cpp -Wno-cpp"; - - gnArgs = [ - "pw_build_PYTHON_PIP_INSTALL_OFFLINE=true" - "pw_build_PYTHON_PIP_INSTALL_DISABLE_CACHE=true" - ''pw_build_PYTHON_PIP_INSTALL_FIND_LINKS=["//wheels"]'' - ]; - - nativeBuildInputs = baseline.nativeBuildInputs ++ [ - setuptools - glib # gdbus-codegen - - pyproject-hooks - ]; - - buildPhase = '' - runHook preBuild - - pushd project-chip - - ln -s ${src-wheels}/wheels wheels - - export HOME=$NIX_BUILD_TOP/home - mkdir $HOME - ninja -C out chip-repl - - popd - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - mkdir $out - - mkdir $out/wheels - cp project-chip/out/controller/python/*.whl $out/wheels - - mkdir $out/wheels-short - for f in $out/wheels/*.whl; do - basef="''${f##*/}" - ln -s "$f" $out/wheels-short/''${basef%%-*}.whl - done - - runHook postInstall - ''; - }); - - outputWheel = name: overrides: buildPythonPackage ({ - pname = name; - inherit (baseline) version; - src = out-wheels; - format = "wheel"; - - preUnpack = '' - src="$(readlink -f "$src/wheels-short/${lib.replaceStrings ["-"] ["_"] name}.whl")" - ''; - } // overrides); -in -rec { - inherit src-wheels; - wheels = out-wheels; - core = outputWheel "home-assistant-chip-core" { - propagatedBuildInputs = [ - aenum - coloredlogs - construct - cryptography - dacite - ecdsa - rich - pyyaml - ipdb - deprecation - mobly - pygobject3 - - clusters - - cython_0 - ]; - - buildInputs = [ - libnl - ]; - - nativeBuildInputs = [ - autoPatchelfHook - ]; - - pythonNamespaces = [ - "chip" - "chip.clusters" - ]; - - pythonImportsCheck = [ - "chip" - "chip.ble" - "chip.configuration" - "chip.clusters" - "chip.discovery" - "chip.exceptions" - "chip.native" - "chip.storage" - ]; - - doCheck = false; # no tests - }; - clusters = outputWheel "home-assistant-chip-clusters" { - propagatedBuildInputs = [ - aenum - dacite - ]; - - pythonNamespaces = [ - "chip" - ]; - - pythonImportsCheck = [ - "chip.clusters.ClusterObjects" - "chip.clusters.enum" - "chip.clusters.Objects" - "chip.clusters.TestObjects" - "chip.clusters.Types" - "chip.tlv" - ]; - }; - repl = outputWheel "home-assistant-chip-repl" { - propagatedBuildInputs = [ - core - clusters - - coloredlogs - ipython - rich - dbus-python - pygobject3 - ]; - - pythonNamespaces = [ - "chip" - ]; - - pythonImportsCheck = [ - "chip.ChipBluezMgr" - ]; - }; -} diff --git a/nix/pkgs/zcl-advanced-platform/default.nix b/nix/pkgs/zcl-advanced-platform/default.nix deleted file mode 100644 index 44c990c390..0000000000 --- a/nix/pkgs/zcl-advanced-platform/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib -, buildNpmPackage -, fetchFromGitHub -, python3 -}: - -buildNpmPackage rec { - pname = "zcl-advanced-platform"; - version = "2023.12.07"; - - src = fetchFromGitHub { - owner = "project-chip"; - repo = "zap"; - rev = "v${version}"; - hash = "sha256-vQ4tlpfh2CUl58l3fhduEK9Gdajf+P28+j/gZPGMcps="; - }; - - nativeBuildInputs = [ - python3 - ]; - - npmDepsHash = "sha256-L7y49Jr9JukHbuzhe3JqpAlKqQYHXKax2uM+RnNiF2o="; - - postInstall = '' - ln -s zap $out/bin/zap-cli - echo '{"hash": "5f1f3a62b27db9f5293f2bfef3ab01e603751a37", "date": "2023-12-07", "zapVersion": "2023.12.07"}' > $out/lib/node_modules/zap/.version.json - ''; - - env.ZAP_SKIP_REAL_VERSION = true; - env.ELECTRON_SKIP_BINARY_DOWNLOAD = true; - env.CYPRESS_INSTALL_BINARY = 0; -} diff --git a/third_party/default.nix b/third_party/default.nix index 764ab72676..1a4a7060f8 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -59,18 +59,6 @@ let nixpkgs = import ./nixpkgs { inherit system; config = nixpkgsConfig; - overlays = [(final: prev: { - zcl-advanced-platform = final.callPackage ../nix/pkgs/zcl-advanced-platform { }; - home-assistant = prev.home-assistant.override { - packageOverrides = final': prev': { - home-assistant-chip = final'.callPackage ../nix/pkgs/home-assistant-chip { - gn = final.gn1924; - }; - home-assistant-chip-core = final'.home-assistant-chip.core; - home-assistant-chip-clusters = final'.home-assistant-chip.clusters; - }; - }; - })]; }; crate2nixSrc = nixpkgs.fetchFromGitHub { owner = "kolloch";