commit 265afd06605361d1727a4e99c4a0612736d84bde
parent 763d6717b452b2352aa1d80fbaec399586c5c9da
Author: mtmn <miro@haravara.org>
Date: Sun, 26 Apr 2026 13:17:41 +0200
nixaran: replace matrix with an irc bouncer
Diffstat:
4 files changed, 89 insertions(+), 3 deletions(-)
diff --git a/hosts/nixaran/configuration.nix b/hosts/nixaran/configuration.nix
Binary files differ.
diff --git a/modules/mixins/dotfiles/config/iamb/config.toml b/modules/mixins/dotfiles/config/iamb/config.toml
@@ -1,3 +0,0 @@
-[profiles."matrix.haravara.org"]
-url = "https://matrix.haravara.org"
-user_id = "@miro:matrix.haravara.org"
diff --git a/modules/services/gamja.nix b/modules/services/gamja.nix
@@ -0,0 +1,41 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.services.haravara.gamja;
+in {
+ options.services.haravara.gamja = {
+ enable = lib.mkEnableOption "Gamja IRC web client (served via Caddy)";
+ domain = lib.mkOption {
+ type = lib.types.str;
+ };
+ serverUrl = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = "WebSocket URL of the soju bouncer (e.g. wss://bouncer.example.org)";
+ };
+ authLabel = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = "The auth snippet to import";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
+ ${lib.optionalString (cfg.authLabel != null) "import ${
+ if cfg.authLabel == "default"
+ then "auth"
+ else "auth_${cfg.authLabel}"
+ }"}
+ root * ${
+ if cfg.serverUrl != null
+ then pkgs.gamja.override {gamjaConfig = {server.url = cfg.serverUrl;};}
+ else pkgs.gamja
+ }
+ file_server
+ '';
+ };
+}
diff --git a/modules/services/soju.nix b/modules/services/soju.nix
@@ -0,0 +1,48 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.services.haravara.soju;
+in {
+ options.services.haravara.soju = {
+ enable = lib.mkEnableOption "soju IRC bouncer";
+ domain = lib.mkOption {
+ type = lib.types.str;
+ description = "Domain for the soju WebSocket endpoint (proxied by Caddy)";
+ };
+ port = lib.mkOption {
+ type = lib.types.port;
+ default = 6669;
+ description = "Internal port for the soju WebSocket listener";
+ };
+ httpOrigins = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = [];
+ description = "Allowed HTTP origins for WebSocket connections (e.g. gamja domain)";
+ };
+ authLabel = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = "The auth snippet to import in Caddy";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.soju = {
+ enable = true;
+ listen = ["ws+insecure://127.0.0.1:${toString cfg.port}"];
+ acceptProxyIP = ["localhost"];
+ inherit (cfg) httpOrigins;
+ };
+
+ services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
+ ${lib.optionalString (cfg.authLabel != null) "import ${
+ if cfg.authLabel == "default"
+ then "auth"
+ else "auth_${cfg.authLabel}"
+ }"}
+ reverse_proxy 127.0.0.1:${toString cfg.port}
+ '';
+ };
+}