summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/HermesLedControl/default.nix
blob: 88aed898d66ed1015ab8ba8bdb5d419b1bc9becd (plain)
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
53
54
{ lib, pkgs, python3Packages, makeWrapper, ... }:

# How to use:
# create configuration .config/HermesLedControl/configuration.yml:
#   engine: "rhasspy"
#   pathToConfig: "/var/lib/rhasspy/de/profile.json"
#   hardware: "respeaker4MicArray"
#   pattern: "fake-name"
#   enableDoA: false


with python3Packages; buildPythonApplication rec {
  name = "HermesLedControl-${version}";
  format = "other";
  version = "3.0.4";

  src = pkgs.fetchFromGitHub {
    owner = "project-alice-assistant";
    repo = "HermesLedControl";
    rev = "v${version}";
    hash = "sha256-fVbTQPSo3fNjLb8PDDDqhMC9Hez01rTH46cKz/mfwoU=";
  };

  patches = [
    ./remove-logger.patch
  ];

  execWrapper = ''
    #!/bin/sh
    cd $out/lib/HermesLedControl && \
      PYTHONPATH="${makePythonPath propagatedBuildInputs}" exec \
        ${python}/bin/python  "$out/lib/HermesLedControl/main.py" "$@"
  '';

  installPhase = ''
    install -d "$out/lib/"
    install -d "$out/bin"
    cp -r . $out/lib/HermesLedControl

    echo "${execWrapper}" > HermesLedControl
    install -Dm755 HermesLedControl $out/bin/HermesLedControl

  '';

  propagatedBuildInputs = [
    spidev gpiozero rpi-gpio pyyaml paho-mqtt types-pyyaml makeWrapper
  ];

  meta = {
    homepage = "https://github.com/project-alice-assistant/HermesLedControl";
    description = "Provides an easy way to control your leds in an Hermes environment";
    license = lib.licenses.gpl3;
  };
}