From 36d6686f0d50b6301230d5f08458f60e466fea7f Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Mon, 13 May 2024 21:50:43 +0800 Subject: [PATCH] home-assistant-custom-components.smartir: replace `disutils` with `packaging` - Format using nixfmt-rfc-style - Add passthru.updateScript --- .../custom-components/smartir/default.nix | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pkgs/servers/home-assistant/custom-components/smartir/default.nix b/pkgs/servers/home-assistant/custom-components/smartir/default.nix index 5dc9eb2473d72..876579639b647 100644 --- a/pkgs/servers/home-assistant/custom-components/smartir/default.nix +++ b/pkgs/servers/home-assistant/custom-components/smartir/default.nix @@ -1,8 +1,11 @@ -{ lib -, buildHomeAssistantComponent -, fetchFromGitHub -, aiofiles -, broadlink +{ + lib, + buildHomeAssistantComponent, + fetchFromGitHub, + fetchpatch, + aiofiles, + broadlink, + nix-update-script, }: buildHomeAssistantComponent rec { @@ -17,6 +20,15 @@ buildHomeAssistantComponent rec { hash = "sha256-E6TM761cuaeQzlbjA+oZ+wt5HTJAfkF2J3i4P1Wbuic="; }; + patches = [ + # Replace distutils.version.StrictVersion with packaging.version.Version + # https://github.com/smartHomeHub/SmartIR/pull/1250 + (fetchpatch { + url = "https://github.com/smartHomeHub/SmartIR/commit/1ed8ef23a8f7b9dcae75721eeab8d5f79013b851.patch"; + hash = "sha256-IhdnTDtUa7mS+Vw/+BqfqWIKK4hbshbVgJNjfKjgAvI="; + }) + ]; + propagatedBuildInputs = [ aiofiles broadlink @@ -28,6 +40,8 @@ buildHomeAssistantComponent rec { cp -r codes $out/custom_components/smartir/ ''; + passthru.updateScript = nix-update-script { }; + meta = with lib; { changelog = "https://github.com/smartHomeHub/SmartIR/releases/tag/v${version}"; description = "Integration for Home Assistant to control climate, TV and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome)";