diff options
Diffstat (limited to 'makefu/2configs/bureautomation/comic-updater.nix')
-rw-r--r-- | makefu/2configs/bureautomation/comic-updater.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix new file mode 100644 index 000000000..5f26bc2c7 --- /dev/null +++ b/makefu/2configs/bureautomation/comic-updater.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, buildPythonPackage, ... }: + +let + mq = "192.168.8.11"; + pkg = pkgs.ampel; +in { + systemd.services.comic-updater = { + startAt = "daily"; + description = "Send led change to message queue"; + after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); + path = with pkgs; [ wget xmlstarlet ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "hass"; + WorkingDirectory = config.services.home-assistant.configDir; + ExecStart = pkgs.writeDash "update-poorly-drawn-lines" '' + set -euf + mkdir -p www/ + cd www/ + pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \ + | xml sel -t -v '/rss/channel/item/content:encoded' \ + | head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' ) + wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png + ''; + PrivateTmp = true; + }; + }; +} |