summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/news.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-02-23 23:42:12 +0100
committerlassulus <lassulus@lassul.us>2021-02-23 23:42:12 +0100
commit924471087c667640bad7ba38b5f9b00f2770f906 (patch)
treefcfffce8236ce86c4967b1eb7a00b353550b5680 /krebs/2configs/news.nix
parent79dab4b2aecd06f2a2a84196af096253a0296418 (diff)
news: build graph.svg on change
Diffstat (limited to 'krebs/2configs/news.nix')
-rw-r--r--krebs/2configs/news.nix31
1 files changed, 31 insertions, 0 deletions
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"
];
};
}