about summary refs log tree commit diff
path: root/pkgs/servers/home-assistant/custom-components/smartir/default.nix
blob: 876579639b6478e3e0f8690f5a64814af4c9ea65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  lib,
  buildHomeAssistantComponent,
  fetchFromGitHub,
  fetchpatch,
  aiofiles,
  broadlink,
  nix-update-script,
}:

buildHomeAssistantComponent rec {
  owner = "smartHomeHub";
  domain = "smartir";
  version = "1.17.9";

  src = fetchFromGitHub {
    owner = "smartHomeHub";
    repo = "SmartIR";
    rev = version;
    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
  ];

  dontBuild = true;

  postInstall = ''
    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)";
    homepage = "https://github.com/smartHomeHub/SmartIR";
    maintainers = with maintainers; [ azuwis ];
    license = licenses.mit;
  };
}