From b3471a308a2a9fe070fc30c47581cafa66b11288 Mon Sep 17 00:00:00 2001 From: "Finn@MiBook" Date: Wed, 29 Jul 2026 17:11:25 +0200 Subject: [PATCH] feat(home-assistant): add alexa_media_player custom component Package the Alexa Media Player HACS component declaratively (v5.15.7), so HA can drive the Echo devices (TTS/announce, media, sensors). Needs dictor 0.1.12 (absent from nixpkgs) and an alexapy 1.29.22 -> 1.29.25 bump to satisfy the manifest's exact requirement pins; both build against HA's interpreter. Config-flow based: add via the HA UI and sign in with the Amazon account after rebuild. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01RCn8YgGQMGpauatdeTdQYf --- .../environments/home-assistant/default.nix | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/modules/environments/home-assistant/default.nix b/modules/environments/home-assistant/default.nix index 54a217c..f5092d6 100644 --- a/modules/environments/home-assistant/default.nix +++ b/modules/environments/home-assistant/default.nix @@ -9,6 +9,39 @@ let cfg = config.my.profiles.home-assistant; hostName = config.networking.hostName; + + # Python deps for the alexa_media_player custom component. Built against + # Home Assistant's own interpreter — the same set buildHomeAssistantComponent + # uses — so HA's build-time and runtime manifest-requirement checks pass. + haPython = pkgs.home-assistant.python3Packages; + + # dictor is not in nixpkgs; alexa_media_player needs dictor>=0.1.12,<0.2. + # Pure-Python, no runtime deps, legacy setup.py. + dictor = haPython.buildPythonPackage { + pname = "dictor"; + version = "0.1.12"; + format = "setuptools"; + src = haPython.fetchPypi { + pname = "dictor"; + version = "0.1.12"; + hash = "sha256-bbSDda4eU9ye2EToWzj04/v79qTmC+yjd1Fa0URTuRs="; + }; + build-system = [ haPython.setuptools ]; + doCheck = false; + pythonImportsCheck = [ "dictor" ]; + }; + + # nixpkgs ships alexapy 1.29.22; the manifest pins ==1.29.25. Patch bump. + # nixpkgs fetches alexapy from GitLab (keatontaylor/alexapy), tag v. + alexapy = haPython.alexapy.overridePythonAttrs (old: { + version = "1.29.25"; + src = pkgs.fetchFromGitLab { + owner = "keatontaylor"; + repo = "alexapy"; + tag = "v1.29.25"; + hash = "sha256-P/hvgqZVaBJF5dbmHrDjQMC+pwV3EEhKyFIS5KmhgD4="; + }; + }); in { @@ -38,6 +71,25 @@ in hash = "sha256-Uoid/2f6GxZMuE5Keu2VjHPYuOxnYG8hsCD6BYcaTvM="; }; }) + (pkgs.buildHomeAssistantComponent { + owner = "Alandtse"; + domain = "alexa_media"; + version = "5.15.7"; + src = pkgs.fetchFromGitHub { + owner = "Alandtse"; + repo = "alexa_media_player"; + rev = "v5.15.7"; + hash = "sha256-1rcZVSX1xA1Lc4qSu39MOitVEciZFhoPQy2y5+PpoAI="; + }; + # Every manifest requirement must be importable at a satisfying + # version or manifestCheckPhase fails the build. + dependencies = [ + alexapy + dictor + haPython.wrapt + haPython.packaging + ]; + }) ]; extraComponents = [