Commit a0ce8f9

HPCesia <me@hpcesia.com>
2026-07-04 07:17:00
Add Artalk service
1 parent d054ea7
Changed files (2)
modules
hosts
hyacine
services
services
modules/hosts/hyacine/services/services.nix
@@ -2,6 +2,10 @@
   den.hosts.hyacine.settings = {
     services.webserver.external = true;
 
+    services.artalk = {
+      domain = "artalk.hpcesia.com";
+    };
+
     services.headscale = {
       domain = "gate.trin.one";
       port = 3465;
@@ -27,6 +31,7 @@
     includes = [
       den.aspects.services.webserver
 
+      den.aspects.services.artalk
       den.aspects.services.headscale
       den.aspects.services.vaultwarden
       den.aspects.services.wakapi
modules/services/artalk.nix
@@ -0,0 +1,68 @@
+{lib, ...}: {
+  den.aspects.services.artalk = {
+    settings = {
+      domain = lib.mkOption {
+        type = lib.types.str;
+      };
+      address = lib.mkOption {
+        type = lib.types.str;
+        default = "127.0.0.1";
+      };
+      port = lib.mkOption {
+        type = lib.types.port;
+        default = 7364;
+      };
+    };
+
+    persist = {config, ...}: let
+      cfg = config.services.artalk;
+    in {
+      directories = [
+        {
+          directory = cfg.workdir;
+          inherit (cfg) user group;
+          mode = "0700";
+        }
+      ];
+      files = lib.optional (cfg.allowModify) {
+        file = cfg.configFile;
+        parentDirectory = {
+          inherit (cfg) user group;
+          mode = "0700";
+        };
+      };
+    };
+
+    reverseProxy = {host, ...}: let
+      cfg = host.settings.services.artalk;
+    in {
+      ${cfg.domain} = {
+        port = cfg.port;
+      };
+    };
+
+    nixos = {host, ...}: let
+      cfg = host.settings.services.artalk;
+    in {
+      services.artalk = {
+        enable = true;
+        allowModify = true;
+        settings = {
+          host = cfg.address;
+          port = cfg.port;
+          debug = false;
+          db = {
+            type = "sqlite";
+            file = "./data/artalk.db";
+            user = "artalk";
+            charset = "utf8mb4";
+          };
+          log = {
+            enabled = true;
+            filename = "./data/artalk.log";
+          };
+        };
+      };
+    };
+  };
+}