From d70e297ef7ad32038045617210dfe576fe3bfd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 15 Dec 2024 13:51:27 -0800 Subject: [PATCH] home-assistant-custom-components.homematicip_local: fail if Home Assistant is too old --- .../custom-components/homematicip_local/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix b/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix index b460d17488242..6c99b07f4c3ac 100644 --- a/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix +++ b/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix @@ -3,6 +3,7 @@ buildHomeAssistantComponent, fetchFromGitHub, hahomematic, + home-assistant, }: buildHomeAssistantComponent rec { @@ -17,6 +18,13 @@ buildHomeAssistantComponent rec { hash = "sha256-1ssmaX6G03i9KYgjCRMZqOG2apEZ0069fQnmVy2BVhA="; }; + postPatch = '' + min_ha_version="$(sed -nr 's/^HMIP_LOCAL_MIN_HA_VERSION.*= "([0-9.]+)"$/\1/p' custom_components/homematicip_local/const.py)" + test \ + "$(printf '%s\n' "$min_ha_version" "${home-assistant.version}" | sort -V | head -n1)" = "$min_ha_version" \ + || (echo "error: only Home Assistant >= $min_ha_version is supported" && exit 1) + ''; + dependencies = [ hahomematic ];