about summary refs log tree commit diff
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
parent2024-10-28 (diff)
2024-10-29
Diffstat (limited to '')
-rw-r--r--configurations/ilmare/default.nix5
-rw-r--r--configurations/manwe/default.nix8
-rw-r--r--configurations/manwe/webserver.nix64
-rw-r--r--lib/my.nix2
-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
-rw-r--r--packages/hiccup.nix6
9 files changed, 117 insertions, 70 deletions
diff --git a/configurations/ilmare/default.nix b/configurations/ilmare/default.nix
index a1b5007..bb89699 100644
--- a/configurations/ilmare/default.nix
+++ b/configurations/ilmare/default.nix
@@ -1,4 +1,7 @@
-_: {
+{ lib, ... }:
+{
+  imports = lib.attrValues (lib.modulesIn ./.);
+
   nixfiles.modules = {
     wireguard.client.enable = true;
 
diff --git a/configurations/manwe/default.nix b/configurations/manwe/default.nix
index 609d2a8..337a43e 100644
--- a/configurations/manwe/default.nix
+++ b/configurations/manwe/default.nix
@@ -1,4 +1,8 @@
-{ config, lib, ... }:
+{
+  config,
+  lib,
+  ...
+}:
 with lib;
 {
   imports = attrValues (modulesIn ./.);
@@ -38,6 +42,8 @@ with lib;
     vaultwarden.enable = true;
     ntfy.enable = true;
     plausible.enable = true;
+    uptime-kuma.enable = true;
+    thelounge.enable = true;
   };
 
   boot = {
diff --git a/configurations/manwe/webserver.nix b/configurations/manwe/webserver.nix
index 95a0b0b..051ddba 100644
--- a/configurations/manwe/webserver.nix
+++ b/configurations/manwe/webserver.nix
@@ -12,70 +12,6 @@ with lib;
     virtualHosts =
       with my.domain;
       {
-        # TODO Start using this.
-        # "start.local" = {
-        #   root = pkgs.hiccup;
-        #   locations = {
-        #     "/".tryFiles = "$uri $uri/ /index.html";
-        #     "~* ^.+config.json$".extraConfig = let
-        #       config = pkgs.writeText "config.json" (generators.toJSON {} {
-        #         version = "2.0";
-        #         id = "default";
-        #         title = "Demo Config";
-        #         url = "./configs/config.json";
-        #         featured = [
-        #           {
-        #             name = "GitHub";
-        #             background = "/assets/card.png";
-        #             link = "https://github.com/ashwin-pc/hiccup";
-        #           }
-        #         ];
-        #         categories = [
-        #           {
-        #             title = "Category 1";
-        #             links = [
-        #               {
-        #                 name = "Link 1";
-        #                 link = "https://example.com";
-        #               }
-        #             ];
-        #           }
-        #           {
-        #             title = "Category 2";
-        #             links = [
-        #               {
-        #                 name = "Link 1";
-        #                 link = "https://example.com";
-        #               }
-        #             ];
-        #           }
-        #           {
-        #             title = "Category 3";
-        #             links = [
-        #               {
-        #                 name = "Link 1";
-        #                 link = "https://example.com";
-        #               }
-        #             ];
-        #           }
-        #           {
-        #             title = "Category 4";
-        #             links = [
-        #               {
-        #                 name = "Link 1";
-        #                 link = "https://example.com";
-        #               }
-        #             ];
-        #           }
-        #         ];
-        #       });
-        #     in ''
-        #       alias ${config};
-        #     '';
-        #   };
-        #   enableACME = false;
-        #   forceSSL = false;
-        # };
         ${shire}.locations."/".return = "301 https://www.youtube.com/watch?v=dQw4w9WgXcQ";
         "git.${shire}".locations."/".return = "301 https://git.${azahi}";
         "bitwarden.${shire}".locations."/".return = "301 https://vaultwarden.${shire}";
diff --git a/lib/my.nix b/lib/my.nix
index f959de2..c8f9d3d 100644
--- a/lib/my.nix
+++ b/lib/my.nix
@@ -185,6 +185,7 @@ with lib;
               "git.${azahi}"
               "git.${shire}"
               "grafana.${shire}"
+              "irc.${shire}"
               "loki.${shire}"
               "ntfy.${shire}"
               "plausible.${shire}"
@@ -192,6 +193,7 @@ with lib;
               "radicale.${shire}"
               "rss-bridge.${shire}"
               "start.local"
+              "uptime.${shire}"
               "vaultwarden.${shire}"
               azahi
               rohan
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
     '';
diff --git a/packages/hiccup.nix b/packages/hiccup.nix
index b0dc64d..f74de74 100644
--- a/packages/hiccup.nix
+++ b/packages/hiccup.nix
@@ -5,16 +5,16 @@
 }:
 buildNpmPackage rec {
   pname = "hiccup";
-  version = "0.4.3";
+  version = "0.5.0";
 
   src = fetchFromGitHub {
     owner = "ashwin-pc";
     repo = pname;
     rev = "v${version}";
-    hash = "sha256-JLuXQ4jZHI9wF1fgnnBPH/TaTHJL/zGCSuKc9hy4e28=";
+    hash = "sha256-krtV//cVBt3EFzVZy9e55LJokDBSsr1xdNTKNOFFxbM=";
   };
 
-  npmDepsHash = "sha256-YPj7tzMUh56rJfxOVhye4cK6VS0azA/LiE9DMweGLuw=";
+  npmDepsHash = "sha256-zxpimQtX03/+0/DgeQEDia82LAd14R4HcGFgASLevHE=";
 
   CYPRESS_INSTALL_BINARY = "0";
 

Consider giving Nix/NixOS a try! <3