summaryrefslogtreecommitdiff
path: root/chaski
diff options
context:
space:
mode:
authorstuebinm2024-03-27 23:52:39 +0100
committerstuebinm2024-03-27 23:52:39 +0100
commitcea96f49fa71e9eaced1fe59fe8c9ab5392c2f6d (patch)
tree9e8fc8e781145385aaccee2303dbf304c55b31fd /chaski
parent9515be799112b405ff293d83705528b1e9237aa3 (diff)
help i wrote a matrix bot
not sure if this is a good idea or not, but i always liked how the IRC #voc-wok channel of the c3voc works, and I don't run my own IRC (nor do i want to have my monitoring on infra that is not my own), so I built a similar thing with matrix.
Diffstat (limited to 'chaski')
-rw-r--r--chaski/configuration.nix3
-rw-r--r--chaski/services/conduit.nix24
2 files changed, 27 insertions, 0 deletions
diff --git a/chaski/configuration.nix b/chaski/configuration.nix
index 875e412..d2b1233 100644
--- a/chaski/configuration.nix
+++ b/chaski/configuration.nix
@@ -15,6 +15,9 @@
./services/conduit.nix
];
+ sops.defaultSopsFile = ../secrets/chaski.yaml;
+ # This will automatically import SSH keys as age keys
+ sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
environment.noXlibs = true;
services.nginx.enable = true;
diff --git a/chaski/services/conduit.nix b/chaski/services/conduit.nix
index 022863c..30d6a0b 100644
--- a/chaski/services/conduit.nix
+++ b/chaski/services/conduit.nix
@@ -1,5 +1,14 @@
{ config, lib, pkgs, ... }:
+let
+ botConfig = pkgs.writeText "ntfy-matrix-bot.toml" ''
+ matrix_homeserver = "https://conduit.stuebinm.eu"
+ matrix_username = "testbot"
+ matrix_rooms = [ "#test:conduit.stuebinm.eu" ]
+ ntfy_server = "https://ping.stuebinm.eu"
+ ntfy_topics = [ "monit" ]
+ '';
+in
{
services.matrix-conduit = {
enable = true;
@@ -11,7 +20,22 @@
port = 6167;
allow_registration = false;
};
+ };
+
+ sops.secrets."ntfy-matrix-bot/env" = {};
+ systemd.services.ntfy-matrix-bot = {
+ enable = true;
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ ExecStart = "${lib.getExe pkgs.ntfy-matrix-bot} -c ${botConfig}";
+ Type = "simple";
+ RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
+ DynamicUser = true;
+ BindPaths = botConfig;
+ EnvironmentFile = "/run/secrets/ntfy-matrix-bot/env";
+ };
+ environment.RUST_LOG = "ntfy_matrix_bot=info";
};
services.nginx.virtualHosts."conduit.stuebinm.eu" = {