about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-10-29 01:00:11 +0300
committerazahi <azat@bahawi.net>2024-10-29 01:00:11 +0300
commita41cd27691891e26b575c26455734851b5216488 (patch)
treec4650e568ede2a0f327e787ea921c306d3111d6b /modules
parent2024-10-28 (diff)
2024-10-29
Diffstat (limited to '')
-rw-r--r--modules/nsd.nix2
-rw-r--r--modules/thelounge.nix49
-rw-r--r--modules/uptime-kuma.nix49
-rw-r--r--modules/wireguard.nix2
4 files changed, 101 insertions, 1 deletions
diff --git a/modules/nsd.nix b/modules/nsd.nix
index 322d88a..1399b5d 100644
--- a/modules/nsd.nix
+++ b/modules/nsd.nix
@@ -148,12 +148,14 @@ in
                     bitwarden = manwe;
                     git = manwe;
                     grafana = manwe;
+                    irc = manwe;
                     loki = manwe;
                     ntfy = manwe;
                     plausible = manwe;
                     prometheus = manwe;
                     radicale = manwe;
                     rss-bridge = manwe;
+                    uptime = manwe;
                     vaultwarden = manwe;
 
                     flood = yavanna;
diff --git a/modules/thelounge.nix b/modules/thelounge.nix
new file mode 100644
index 0000000..ae4b4ff
--- /dev/null
+++ b/modules/thelounge.nix
@@ -0,0 +1,49 @@
+{
+  config,
+  lib,
+  libNginx,
+  ...
+}:
+let
+  cfg = config.nixfiles.modules.thelounge;
+in
+{
+  options.nixfiles.modules.thelounge = {
+    enable = lib.mkEnableOption "The Lounge";
+
+    port = lib.mkOption {
+      description = "Port.";
+      type = lib.types.port;
+      default = 11887;
+    };
+
+    domain = lib.mkOption {
+      description = "Domain name sans protocol scheme.";
+      type = lib.types.str;
+      default = "irc.${config.networking.domain}";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    ark.directories = [ "/var/lib/thelounge" ];
+
+    nixfiles.modules.nginx = {
+      upstreams.thelounge.servers."127.0.0.1:${toString cfg.port}" = { };
+      virtualHosts.${cfg.domain} = {
+        locations."/".proxyPass = "http://thelounge";
+        extraConfig = libNginx.config.internalOnly;
+      };
+    };
+
+    services.thelounge = {
+      enable = true;
+      extraConfig = {
+        public = false;
+        host = "127.0.0.1";
+        inherit (cfg) port;
+        reverseProxy = true;
+        defaults = { };
+      };
+    };
+  };
+}
diff --git a/modules/uptime-kuma.nix b/modules/uptime-kuma.nix
new file mode 100644
index 0000000..5f48d0d
--- /dev/null
+++ b/modules/uptime-kuma.nix
@@ -0,0 +1,49 @@
+{
+  config,
+  lib,
+  libNginx,
+  ...
+}:
+let
+  cfg = config.nixfiles.modules.uptime-kuma;
+in
+{
+  options.nixfiles.modules.uptime-kuma = {
+    enable = lib.mkEnableOption "Uptime Kuma";
+
+    port = lib.mkOption {
+      description = "Port.";
+      type = lib.types.port;
+      default = 9988;
+    };
+
+    domain = lib.mkOption {
+      description = "Domain name sans protocol scheme.";
+      type = lib.types.str;
+      default = "uptime.${config.networking.domain}";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    ark.directories = [
+      "/var/lib/private/uptime-kuma"
+      "/var/lib/uptime-kuma"
+    ];
+
+    nixfiles.modules.nginx = {
+      upstreams.uptime-kuma.servers."127.0.0.1:${toString cfg.port}" = { };
+      virtualHosts.${cfg.domain} = {
+        locations."/".proxyPass = "http://uptime-kuma";
+        extraConfig = libNginx.config.internalOnly;
+      };
+    };
+
+    services.uptime-kuma = {
+      enable = true;
+      settings = {
+        UPTIME_KUMA_HOST = "127.0.0.1";
+        UPTIME_KUMA_PORT = toString cfg.port;
+      };
+    };
+  };
+}
diff --git a/modules/wireguard.nix b/modules/wireguard.nix
index 3589e12..dcd7858 100644
--- a/modules/wireguard.nix
+++ b/modules/wireguard.nix
@@ -16,7 +16,7 @@ let
     in
     ''
       ${resolvectl} dns ${cfg.interface} ${cfg.server.ipv6.address} ${cfg.server.ipv4.address}
-      ${resolvectl} domain ${cfg.interface} ${my.domain.shire}
+      ${resolvectl} domain ${cfg.interface} local ${my.domain.shire}
       ${resolvectl} dnssec ${cfg.interface} no
       ${resolvectl} dnsovertls ${cfg.interface} no
     '';

Consider giving Nix/NixOS a try! <3