about summary refs log tree commit diff
path: root/modules/nixos/soju.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/soju.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/nixos/soju.nix b/modules/nixos/soju.nix
index 14faf00..3cfe015 100644
--- a/modules/nixos/soju.nix
+++ b/modules/nixos/soju.nix
@@ -34,6 +34,16 @@ in {
       type = with types; str;
       default = config.networking.fqdn;
     };
+
+    prometheus = {
+      enable = mkEnableOption "Prometheus exporter." // {default = true;};
+
+      port = mkOption {
+        description = "Port.";
+        type = with types; port;
+        default = 9259;
+      };
+    };
   };
 
   config = let
@@ -68,6 +78,11 @@ in {
             # https://soju.im/doc/soju.1.html
             configFile = pkgs.writeText "soju.conf" ''
               listen ${cfg.protocol}://${cfg.address}:${toString cfg.port}
+              ${
+                with cfg.prometheus;
+                  optionalString enable
+                  "listen http+prometheus://localhost:${toString port}"
+              }
               db postgres ${
                 concatStringsSep " " [
                   "host=/run/postgresql"

Consider giving Nix/NixOS a try! <3