ma google-muell: bump to latest version, use new config

This commit is contained in:
makefu 2019-02-09 23:19:53 +01:00
parent 6e82401de7
commit 7661181528
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 14 additions and 7 deletions

View File

@ -3,13 +3,20 @@ with import <stockholm/lib>;
let let
pkg = pkgs.ampel; pkg = pkgs.ampel;
home = "/var/lib/ampel"; home = "/var/lib/ampel";
sec = "${toString <secrets>}/google-muell.json"; sec = "${toString <secrets>}/ampel/google-muell.json";
ampelsec = "${home}/google-muell.json"; ampelsec = "${home}/google-muell.json";
cred = "${toString <secrets>}/google-muell-creds.json"; cred = "${toString <secrets>}/ampel/google-muell-creds.json";
# TODO: generate this credential file locally # TODO: generate this credential file locally
ampelcred = "${home}/google-muell-creds.json"; ampelcred = "${home}/google-muell-creds.json";
esp = "192.168.8.204";
sleepval = "1800"; sleepval = "1800";
default-color = "244,220,66";
config_json = toFile "config.json" (toJSON {
mq_hostname = "localhost";
mq_port = 1883;
mq_username = "sensor";
mq_topic = "/ham/flurlicht/cmnd/MEM1";
mq_password = replaceChars ["\n"] [""] (readFile "${toString <secrets>}/mqtt/sensor");
});
in { in {
users.users.ampel = { users.users.ampel = {
uid = genid "ampel"; uid = genid "ampel";
@ -27,7 +34,7 @@ in {
install -m600 -o ampel ${sec} ${ampelsec} install -m600 -o ampel ${sec} ${ampelsec}
install -m600 -o ampel ${cred} ${ampelcred} install -m600 -o ampel ${cred} ${ampelcred}
''; '';
ExecStart = "${pkg}/bin/google-muell --esp=${esp} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}"; ExecStart = "${pkg}/bin/google-muell --config ${config_json} --default-color=${default-color} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}";
PermissionsStartOnly = true; PermissionsStartOnly = true;
Restart = "always"; Restart = "always";
RestartSec = 10; RestartSec = 10;

View File

@ -2,7 +2,7 @@
with pkgs.python3Packages;buildPythonPackage rec { with pkgs.python3Packages;buildPythonPackage rec {
name = "ampel-${version}"; name = "ampel-${version}";
version = "0.2.1"; version = "0.2.4";
propagatedBuildInputs = [ propagatedBuildInputs = [
docopt docopt
@ -16,8 +16,8 @@ with pkgs.python3Packages;buildPythonPackage rec {
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "http://cgit.euer.krebsco.de/ampel"; url = "http://cgit.euer.krebsco.de/ampel";
rev = "92321d7"; rev = "04e1c8c38ffe53175ae719121ad88534a8a662db";
sha256 = "0mvpbpf1rx8sc589qjb73gl8z6fir2zs3gl3br1pbhg5jgn0ij4n"; sha256 = "00jgr3jg2yi91hd7388v8rncfbq8fx8dvr03sg749dzpsg58hfxn";
}; };
meta = { meta = {
homepage = http://cgit.euer.krebsco.de/ampel; homepage = http://cgit.euer.krebsco.de/ampel;