hackens-org-configurations/hosts/org/kfet2mqtt.nix
2022-08-08 13:20:43 +02:00

25 lines
700 B
Nix

{ 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 = "4a9ca954fd4405ccbabdb0793f1a2f76c7561a8e";
sha256 = "1g4gv2mc0kd108yw8y6gbskg8zhnrlwdnza8mhii2n8jidh63485";
};
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" ];
};
}