diff options
author | makefu <github@syntax-fehler.de> | 2017-05-11 16:06:41 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-05-11 16:06:41 +0200 |
commit | d2f896842e59f2e8bdce44926b1bf49672c9c91f (patch) | |
tree | 3e4fa3399c9211f6eb8ecd4fe57117c6ef7c9801 /makefu/2configs/deployment/led-fader.nix | |
parent | 52329b41431de750131c3180b8ab72acfff5152c (diff) |
m 2 led-fader: rm ad-hoc script
Diffstat (limited to 'makefu/2configs/deployment/led-fader.nix')
-rw-r--r-- | makefu/2configs/deployment/led-fader.nix | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/led-fader.nix b/makefu/2configs/deployment/led-fader.nix new file mode 100644 index 000000000..fee741997 --- /dev/null +++ b/makefu/2configs/deployment/led-fader.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with import <stockholm/lib>; +let + mq = "192.168.8.11"; +in { + systemd.services.led-fader = { + description = "Send led change to message queue"; + environment = { + NIX_PATH = "/var/src"; + }; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + nix # nix-shell + mosquitto #mosquitto_pub + bash # nix-shell + ]; + serviceConfig = { + # User = "nobody"; # need a user with permissions to run nix-shell + ExecStart = pkgs.writeDash "run-fader" '' + ${./fade.py} --add-empty --mode chain 3 loop --skip-unchanged 0.002 0.1 \ + | mosquitto_pub -h ${mq} -p 1883 -l -t '/leds/nodemcu-switcher/set' + ''; + PrivateTmp = true; + }; + }; +} |