summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/news-host.nix12
-rw-r--r--krebs/2configs/news.nix53
-rw-r--r--krebs/2configs/syncthing.nix15
3 files changed, 78 insertions, 2 deletions
diff --git a/krebs/2configs/news-host.nix b/krebs/2configs/news-host.nix
new file mode 100644
index 000000000..82360a670
--- /dev/null
+++ b/krebs/2configs/news-host.nix
@@ -0,0 +1,12 @@
+{
+ krebs.sync-containers.containers.news = {
+ peers = [
+ "shodan"
+ "mors"
+ "styx"
+ ];
+ hostIp = "10.233.2.101";
+ localIp = "10.233.2.102";
+ format = "plain";
+ };
+}
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix
index f40997f82..a492b0782 100644
--- a/krebs/2configs/news.nix
+++ b/krebs/2configs/news.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
{
services.rss-bridge = {
@@ -22,7 +22,6 @@
"d /var/lib/brockman 1750 brockman nginx -"
];
- systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG";
krebs.brockman = {
enable = true;
config = {
@@ -36,4 +35,54 @@
bots = {};
};
};
+
+ krebs.reaktor2.news = {
+ hostname = "localhost";
+ port = "6667";
+ nick = "brockman-helper";
+ plugins = [
+ {
+ plugin = "register";
+ config = {
+ channels = [
+ "#all"
+ "#aluhut"
+ "#news"
+ ];
+ };
+ }
+ {
+ plugin = "system";
+ config = {
+ hooks.PRIVMSG = [
+ {
+ activate = "match";
+ pattern = "^(?:.*\\s)?\\s*brockman-helper:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
+ command = 1;
+ arguments = [2];
+ commands = {
+ add-telegram.filename = pkgs.writeDash "add-telegram" ''
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: add-telegram $telegramname'
+ echo "$#"
+ exit 1
+ fi
+ echo "brockman: add t_$1 http://rss.r/?action=display&bridge=Telegram&username=$1&format=Mrss"
+ '';
+ search.filename = pkgs.writeDash "search" ''
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: search $searchterm'
+ echo "$#"
+ exit 1
+ fi
+ ${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$1&info=true&favicon=false" |
+ ${pkgs.jq}/bin/jq '.[].url'
+ '';
+ };
+ }
+ ];
+ };
+ }
+ ];
+ };
}
diff --git a/krebs/2configs/syncthing.nix b/krebs/2configs/syncthing.nix
new file mode 100644
index 000000000..31e33ad5e
--- /dev/null
+++ b/krebs/2configs/syncthing.nix
@@ -0,0 +1,15 @@
+{ config, pkgs, ... }: with import <stockholm/lib>; let
+ mk_peers = mapAttrs (n: v: { id = v.syncthing.id; });
+
+ all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts;
+ used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.declarative.folders));
+ used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers;
+in {
+ services.syncthing = {
+ enable = true;
+ configDir = "/var/lib/syncthing";
+ declarative = {
+ devices = mk_peers used_peers;
+ };
+ };
+}