ma pkgs.HermesLedControl: init at 3.0.4
This commit is contained in:
parent
ac4728cd2a
commit
1c27953bdd
54
makefu/5pkgs/HermesLedControl/default.nix
Normal file
54
makefu/5pkgs/HermesLedControl/default.nix
Normal file
@ -0,0 +1,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;
|
||||
};
|
||||
}
|
31
makefu/5pkgs/HermesLedControl/remove-logger.patch
Normal file
31
makefu/5pkgs/HermesLedControl/remove-logger.patch
Normal file
@ -0,0 +1,31 @@
|
||||
diff --git a/main.py b/main.py
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 9b5a269..350d443
|
||||
--- a/main.py
|
||||
+++ b/main.py
|
||||
@@ -1,3 +1,4 @@
|
||||
+#!/usr/bin/env python3
|
||||
from logging import handlers
|
||||
|
||||
import logging
|
||||
@@ -17,18 +18,6 @@ _logger.setLevel(logging.DEBUG)
|
||||
|
||||
date = int(datetime.now().strftime('%Y%m%d'))
|
||||
|
||||
-handler = logging.FileHandler(filename='logs.log', mode='w')
|
||||
-rotatingHandler = handlers.RotatingFileHandler(filename=f'./logs/{date}-logs.log', mode='a', maxBytes=100000, backupCount=5)
|
||||
-streamHandler = logging.StreamHandler()
|
||||
-
|
||||
-handler.setFormatter(formatter)
|
||||
-rotatingHandler.setFormatter(formatter)
|
||||
-streamHandler.setFormatter(formatter)
|
||||
-
|
||||
-_logger.addHandler(handler)
|
||||
-_logger.addHandler(rotatingHandler)
|
||||
-_logger.addHandler(streamHandler)
|
||||
-
|
||||
|
||||
def stopHandler(_signum, frame):
|
||||
onStop()
|
||||
|
Loading…
Reference in New Issue
Block a user