26 lines
700 B
Nix
26 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 = "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" ];
|
||
|
};
|
||
|
}
|