mixer-mqtt service: run at boot + move ips into vars

This commit is contained in:
coon 2025-10-24 20:29:44 +00:00
parent 5d39ab08f2
commit ae329caf6f

View file

@ -19,14 +19,15 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
git git
# (python3.withPackages (p: with p; [paho-mqtt mido])) # enable for local testing
]; ];
systemd.services.mixer-mqtt = { systemd.services.mixer-mqtt = {
wantedBy = [ "multi-user.target" ]; # auto-start at boot wantedBy = ["multi-user.target"];
serviceConfig = let
serviceConfig = { mixer_ip = "172.23.42.20";
ExecStart = "${pkgs.python3.withPackages (p: with p; [ paho-mqtt mido ])}/bin/python3 /root/mixer-rpc/mqtt_client.py 172.23.42.20 172.23.42.25"; mqtt_ip = "172.23.42.25";
in {
ExecStart = "${pkgs.python3.withPackages (p: with p; [ paho-mqtt mido ])}/bin/python3 /root/mixer-rpc/mqtt_client.py ${mixer_ip} ${mqtt_ip}";
Restart = "always"; Restart = "always";
RestartSec = 5; RestartSec = 5;
Environment = "PYTHONUNBUFFERED=1"; Environment = "PYTHONUNBUFFERED=1";