From 924471087c667640bad7ba38b5f9b00f2770f906 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 23 Feb 2021 23:42:12 +0100 Subject: news: build graph.svg on change --- krebs/2configs/news.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix index 780c270bf..a6cf02c17 100644 --- a/krebs/2configs/news.nix +++ b/krebs/2configs/news.nix @@ -29,6 +29,36 @@ "d /var/lib/brockman 1750 brockman nginx -" ]; + systemd.services.brockman-graph = { + path = [ + pkgs.graphviz + pkgs.jq + pkgs.inotifyTools + ]; + serviceConfig = { + ExecStart = pkgs.writers.writeDash "brockman-graph" '' + + while :; do + graphviz="$(cat /var/lib/brockman/brockman.json \ + | jq -r ' + .bots | + to_entries | + map(select(.value.extraChannels|length > 1 )) | + .[] | + "\"\(.key)\" -> {\(.value.extraChannels|map("\""+.+"\"")|join(" "))}" + ')" + echo "digraph news { $graphviz }" | circo -Tsvg > /var/lib/brockman/graph.svg + + inotifywait -q -e MODIFY /var/lib/brockman/brockman.json + done + ''; + User = "brockman"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + systemd.services.brockman.serviceConfig.LimitNOFILE = 16384; + systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG"; krebs.brockman = { enable = true; config = { @@ -57,6 +87,7 @@ "#all" "#aluhut" "#news" + "#lasstube" ]; }; } -- cgit v1.2.3