hackens-org-configurations/hosts/hackens-org/kfet2mqtt.nix

26 lines
700 B
Nix
Raw Normal View History

2022-04-25 10:11:02 +02:00
{ pkgs, ... }:
let
python = pkgs.python39.withPackages (ps: [
ps.asyncio-mqtt
ps.websockets
]);
script = pkgs.fetchgit {
url = "https://git.eleves.ens.fr/hackens/kfet2mqtt.git";
2022-06-09 22:13:12 +02:00
rev = "4a9ca954fd4405ccbabdb0793f1a2f76c7561a8e";
sha256 = "1g4gv2mc0kd108yw8y6gbskg8zhnrlwdnza8mhii2n8jidh63485";
2022-04-25 10:11:02 +02:00
};
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" ];
};
}