kfet2mqtt

This commit is contained in:
sinavir 2022-04-25 10:11:02 +02:00
parent 7ab97c1643
commit a6fc45f870
2 changed files with 26 additions and 0 deletions

View file

@ -14,6 +14,7 @@
./webpass.nix
./mosquitto.nix
./prometheus
./kfet2mqtt.nix
# ./bridge.nix
# ./gha.nix
# ./sync.nix

View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
let
python = pkgs.python39.withPackages (ps: [
ps.asyncio-mqtt
ps.websockets
]);
script = pkgs.fetchgit {
url = "https://git.eleves.ens.fr/hackens/kfet2mqtt.git";
rev = "30d948dc2f7b4a0b440445ef578b6ed718a53273";
sha256 = "0d93jc0cwx1a8rhq9m0lwzqp53jsffr9qyswdkwydji14f3kwd4d";
};
in
{
systemd.services."kfet2mqtt" = {
enable = true;
description = "Programme qui indique l'ouverture de la k-fet sur le broker mqtt d'hackENS";
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${python}/bin/python ${script}/script.py";
Restart = "always";
RestartSec = 10;
};
wantedBy = [ "mulit-user.target" ];
};
}