From d6d7102a4bbabbb5a4028c9567e16df03edc640b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 16 Nov 2025 18:59:51 -0800 Subject: [PATCH 1/3] home-assistant: reduce dependencies --- pkgs/servers/home-assistant/default.nix | 13 +++---------- pkgs/servers/home-assistant/tests.nix | 10 +++++++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index e13ae67adf8f..7483b9cfa632 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -376,7 +376,6 @@ python.pkgs.buildPythonApplication rec { dependencies = with python.pkgs; [ # Only packages required in pyproject.toml aiodns - aiofiles aiohasupervisor aiohttp aiohttp-asyncmdnsresolver @@ -396,28 +395,20 @@ python.pkgs.buildPythonApplication rec { cronsim cryptography fnv-hash-fast - ha-ffmpeg hass-nabucasa - hassil home-assistant-bluetooth - home-assistant-intents httpx ifaddr jinja2 lru-dict - mutagen - numpy orjson packaging pillow propcache psutil-home-assistant pyjwt - pymicro-vad pyopenssl - pyspeex-noise python-slugify - pyturbojpeg pyyaml requests securetar @@ -467,8 +458,10 @@ python.pkgs.buildPythonApplication rec { ] ++ lib.concatMap (component: getPackages component python.pkgs) [ # some components are needed even if tests in tests/components are disabled - "default_config" + "assist_pipeline" + "frontend" "hue" + "mobile_app" ]; pytestFlags = [ diff --git a/pkgs/servers/home-assistant/tests.nix b/pkgs/servers/home-assistant/tests.nix index 19d31b0c774a..08458c2fb5fa 100644 --- a/pkgs/servers/home-assistant/tests.nix +++ b/pkgs/servers/home-assistant/tests.nix @@ -9,6 +9,9 @@ let # some components' tests have additional dependencies extraCheckInputs = with home-assistant.python.pkgs; { axis = getComponentDeps "deconz"; + emulated_hue = [ + defusedxml + ]; homeassistant_connect_zbt2 = getComponentDeps "zha"; gardena_bluetooth = getComponentDeps "husqvarna_automower_ble"; govee_ble = [ @@ -29,6 +32,9 @@ let raspberry_pi = [ rpi-bad-power ]; + rss_feed_template = [ + defusedxml + ]; shelly = [ pyswitchbot ]; @@ -42,9 +48,7 @@ let xiaomi_miio = [ arrow ]; - zeroconf = [ - aioshelly - ]; + zeroconf = getComponentDeps "shelly"; zha = [ pydeconz ]; From b432285eee369eabe703ffeba48a7c1dabd4c070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 16 Nov 2025 22:20:49 -0800 Subject: [PATCH 2/3] home-assistant-custom-components.moonraker: fix tests --- .../home-assistant/custom-components/moonraker/package.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/custom-components/moonraker/package.nix b/pkgs/servers/home-assistant/custom-components/moonraker/package.nix index 05cbc40897c3..2cb9f006e74d 100644 --- a/pkgs/servers/home-assistant/custom-components/moonraker/package.nix +++ b/pkgs/servers/home-assistant/custom-components/moonraker/package.nix @@ -2,6 +2,7 @@ lib, buildHomeAssistantComponent, fetchFromGitHub, + home-assistant, pytestCheckHook, pytest-cov-stub, pytest-homeassistant-custom-component, @@ -30,7 +31,8 @@ buildHomeAssistantComponent rec { pytest-homeassistant-custom-component pytest-cov-stub pytestCheckHook - ]; + ] + ++ home-assistant.getPackages "camera" home-assistant.python.pkgs; #skip phases with nothing to do dontConfigure = true; From 3b49b8934cf851ff17b1411d909edc8a27eb1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 16 Nov 2025 22:31:31 -0800 Subject: [PATCH 3/3] home-assistant-component-tests: don't use all of home-assistant's nativeCheckInputs --- pkgs/servers/home-assistant/default.nix | 35 ++++--- pkgs/servers/home-assistant/tests.nix | 127 +++++++++++++++++++++--- 2 files changed, 132 insertions(+), 30 deletions(-) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 7483b9cfa632..f67328acd3a7 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -435,27 +435,30 @@ python.pkgs.buildPythonApplication rec { # upstream only tests on Linux, so do we. doCheck = stdenv.hostPlatform.isLinux; + requirementsTest = with python.pkgs; [ + # test infrastructure (selectively from requirement_test.txt) + freezegun + pytest-asyncio + pytest-aiohttp + pytest-freezer + pytest-socket + pytest-timeout + pytest-unordered + pytest-xdist + pytestCheckHook + requests-mock + respx + syrupy + ]; + nativeCheckInputs = - with python.pkgs; - [ - # test infrastructure (selectively from requirement_test.txt) - freezegun - pytest-asyncio - pytest-aiohttp - pytest-freezer - pytest-socket - pytest-timeout - pytest-unordered - pytest-xdist - pytestCheckHook - requests-mock - respx - syrupy + requirementsTest + ++ (with python.pkgs; [ # Used in tests/non_packaged_scripts/test_alexa_locales.py beautifulsoup4 # Used in tests/scripts/test_check_config.py colorlog - ] + ]) ++ lib.concatMap (component: getPackages component python.pkgs) [ # some components are needed even if tests in tests/components are disabled "assist_pipeline" diff --git a/pkgs/servers/home-assistant/tests.nix b/pkgs/servers/home-assistant/tests.nix index 08458c2fb5fa..0ba85f3d459b 100644 --- a/pkgs/servers/home-assistant/tests.nix +++ b/pkgs/servers/home-assistant/tests.nix @@ -8,50 +8,149 @@ let # some components' tests have additional dependencies extraCheckInputs = with home-assistant.python.pkgs; { - axis = getComponentDeps "deconz"; - emulated_hue = [ + abode = getComponentDeps "camera"; + agent_dvr = getComponentDeps "camera"; + air_quality = getComponentDeps "camera" ++ getComponentDeps "conversation"; + alexa = getComponentDeps "cloud" ++ getComponentDeps "frontend" ++ getComponentDeps "stream"; + android_ip_webcam = getComponentDeps "camera"; + assist_pipeline = getComponentDeps "frontend"; + automation = getComponentDeps "frontend" ++ getComponentDeps "mobile_app"; + axis = getComponentDeps "camera" ++ getComponentDeps "deconz"; + blink = getComponentDeps "camera"; + bthome = getComponentDeps "frontend"; + buienradar = getComponentDeps "camera"; + camera = getComponentDeps "conversation" ++ getComponentDeps "stream"; + canary = getComponentDeps "camera"; + climate = getComponentDeps "conversation"; + color_extractor = getComponentDeps "camera" ++ getComponentDeps "conversation"; + deconz = getComponentDeps "frontend"; + demo = getComponentDeps "camera"; + device_tracker = getComponentDeps "conversation"; + dialogflow = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + dlib_face_detect = getComponentDeps "image_processing"; + dlib_face_identify = getComponentDeps "image_processing"; + doorbird = getComponentDeps "camera"; + dremel_3d_printer = getComponentDeps "camera"; + elevenlabs = getComponentDeps "tts"; + elkm1 = getComponentDeps "frontend"; + emulated_hue = getComponentDeps "conversation" ++ [ defusedxml ]; - homeassistant_connect_zbt2 = getComponentDeps "zha"; + emulated_kasa = getComponentDeps "camera" ++ getComponentDeps "conversation"; + environment_canada = getComponentDeps "camera"; + esphome = getComponentDeps "camera"; + fan = getComponentDeps "conversation"; + foscam = getComponentDeps "camera"; + freebox = getComponentDeps "camera"; + fully_kiosk = getComponentDeps "camera"; gardena_bluetooth = getComponentDeps "husqvarna_automower_ble"; + geofency = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + google_assistant = getComponentDeps "conversation"; + google_assistant_sdk = getComponentDeps "conversation" ++ getComponentDeps "frontend"; + google_cloud = getComponentDeps "tts"; + google_drive = getComponentDeps "frontend"; + google_generative_ai_conversation = getComponentDeps "ai_task"; + google_translate = getComponentDeps "tts"; govee_ble = [ ibeacon-ble ]; - hassio = getComponentDeps "homeassistant_yellow"; + gpslogger = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + group = getComponentDeps "camera" ++ getComponentDeps "conversation"; + hassio = getComponentDeps "frontend" ++ getComponentDeps "homeassistant_yellow"; + homeassistant = getComponentDeps "camera" ++ getComponentDeps "conversation"; + homeassistant_connect_zbt2 = getComponentDeps "zha"; homeassistant_hardware = getComponentDeps "otbr" ++ getComponentDeps "zha"; homeassistant_sky_connect = getComponentDeps "zha"; homeassistant_yellow = getComponentDeps "zha"; + homekit = getComponentDeps "conversation" ++ getComponentDeps "frontend"; + homekit_controller = getComponentDeps "camera"; + http = getComponentDeps "cloud" ++ getComponentDeps "frontend"; + humidifier = getComponentDeps "conversation"; + hyperion = getComponentDeps "camera"; + ifttt = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + image_processing = getComponentDeps "conversation"; + intent = getComponentDeps "conversation"; + light = getComponentDeps "conversation"; + local_file = getComponentDeps "camera"; + locative = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + logbook = getComponentDeps "alexa"; lovelace = [ pychromecast ]; - onboarding = [ + lutron_caseta = getComponentDeps "frontend"; + mailgun = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + marytts = getComponentDeps "tts"; + media_player = getComponentDeps "camera" ++ getComponentDeps "conversation"; + microsoft = getComponentDeps "tts"; + microsoft_face_detect = getComponentDeps "conversation"; + microsoft_face_identify = getComponentDeps "conversation"; + mjpeg = getComponentDeps "camera"; + mobile_app = getComponentDeps "frontend"; + motioneye = getComponentDeps "camera"; + mqtt = getComponentDeps "camera"; + nest = getComponentDeps "camera" ++ [ + av + ]; + number = getComponentDeps "conversation"; + octoprint = getComponentDeps "camera"; + ollama = getComponentDeps "ai_task"; + onboarding = getComponentDeps "tts" ++ [ pymetno radios rpi-bad-power ]; + onvif = getComponentDeps "camera"; + open_router = getComponentDeps "ai_task"; + openai_conversation = getComponentDeps "camera"; + openalpr_cloud = getComponentDeps "camera" ++ getComponentDeps "conversation"; + prosegur = getComponentDeps "camera"; + prusalink = getComponentDeps "camera"; + push = getComponentDeps "camera"; raspberry_pi = [ rpi-bad-power ]; + reolink = getComponentDeps "stream"; + ring = getComponentDeps "camera"; + roku = getComponentDeps "camera"; rss_feed_template = [ defusedxml ]; - shelly = [ - pyswitchbot - ]; + script = getComponentDeps "frontend" ++ getComponentDeps "mobile_app"; + sensor = getComponentDeps "camera" ++ getComponentDeps "conversation"; + shelly = getComponentDeps "frontend" ++ getComponentDeps "switchbot"; + sighthound = getComponentDeps "conversation" ++ getComponentDeps "image_processing"; + skybell = getComponentDeps "camera"; + sleep_as_android = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; songpal = [ isal ]; swiss_public_transport = getComponentDeps "cookidoo"; + switch = getComponentDeps "camera" ++ getComponentDeps "conversation"; + switch_as_x = getComponentDeps "camera" ++ getComponentDeps "conversation"; + synology_dsm = getComponentDeps "camera"; system_log = [ isal ]; + tasmota = getComponentDeps "camera"; + todo = getComponentDeps "conversation"; + traccar = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + trafikverket_camera = getComponentDeps "camera"; + tts = getComponentDeps "conversation"; + tuya = getComponentDeps "camera"; + twilio = getComponentDeps "assist_pipeline" ++ getComponentDeps "camera"; + unifiprotect = getComponentDeps "camera"; + universal = getComponentDeps "camera" ++ getComponentDeps "conversation"; + uvc = getComponentDeps "camera"; + voicerss = getComponentDeps "tts"; + weather = getComponentDeps "conversation"; + websocket_api = getComponentDeps "camera" ++ getComponentDeps "conversation"; xiaomi_miio = [ arrow ]; + yandextts = getComponentDeps "tts"; zeroconf = getComponentDeps "shelly"; - zha = [ - pydeconz - ]; + zha = getComponentDeps "deconz" ++ getComponentDeps "frontend"; + zwave_js = getComponentDeps "frontend"; }; extraDisabledTestPaths = { @@ -133,12 +232,12 @@ lib.listToAttrs ( dontInstall = true; nativeCheckInputs = - old.nativeCheckInputs + old.requirementsTest ++ home-assistant.getPackages component home-assistant.python.pkgs ++ extraCheckInputs.${component} or [ ]; - disabledTests = old.disabledTests or [ ] ++ extraDisabledTests.${component} or [ ]; - disabledTestPaths = old.disabledTestPaths or [ ] ++ extraDisabledTestPaths.${component} or [ ]; + disabledTests = extraDisabledTests.${component} or [ ]; + disabledTestPaths = extraDisabledTestPaths.${component} or [ ]; # components are more often racy than the core dontUsePytestXdist = true;