about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-05-05 14:28:31 +0300
committerAzat Bahawi <azat@bahawi.net>2024-05-05 14:28:31 +0300
commit389becf9700d3dee7f09073ce4d235fc7c30b5c8 (patch)
tree3db9d75bd5275614fc904184c97b3133f38bc3d0
parent2024-05-04 (diff)
2024-05-05
-rw-r--r--configurations/eonwe/default.nix2
-rw-r--r--flake.lock17
-rw-r--r--flake.nix4
-rw-r--r--media/k3s.svg1
-rw-r--r--modules/alertmanager.nix6
-rw-r--r--modules/clickhouse.nix16
-rw-r--r--modules/ipfs.nix32
-rw-r--r--modules/jackett.nix11
-rw-r--r--modules/k3s.nix2
-rw-r--r--modules/lidarr.nix8
-rw-r--r--modules/loki.nix7
-rw-r--r--modules/matrix/dendrite.nix12
-rw-r--r--modules/nsd.nix10
-rw-r--r--modules/ntfy.nix10
-rw-r--r--modules/plausible.nix10
-rw-r--r--modules/postgresql.nix9
-rw-r--r--modules/prometheus.nix11
-rw-r--r--modules/unbound.nix11
-rw-r--r--modules/vaultwarden.nix7
19 files changed, 172 insertions, 14 deletions
diff --git a/configurations/eonwe/default.nix b/configurations/eonwe/default.nix
index 1904cdb..1d246c6 100644
--- a/configurations/eonwe/default.nix
+++ b/configurations/eonwe/default.nix
@@ -34,7 +34,7 @@ with lib;
 
   hm = {
     home.packages = with pkgs; [
-      anki
+      # anki
       gzdoom
       iaito
       kdenlive
diff --git a/flake.lock b/flake.lock
index c7e06de..31d2a39 100644
--- a/flake.lock
+++ b/flake.lock
@@ -578,6 +578,22 @@
         "type": "github"
       }
     },
+    "homelab-svg-assets": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1713467357,
+        "narHash": "sha256-DwjQVWgN8Ys9IbiR18IHMlAKD2q5dgdWSxP/Ze1kRQA=",
+        "owner": "loganmarchione",
+        "repo": "homelab-svg-assets",
+        "rev": "8bb1d84d848155e2d9eb1680a2e04b1bb51f3da8",
+        "type": "github"
+      },
+      "original": {
+        "owner": "loganmarchione",
+        "repo": "homelab-svg-assets",
+        "type": "github"
+      }
+    },
     "impermanence": {
       "locked": {
         "lastModified": 1708968331,
@@ -793,6 +809,7 @@
         "flake-registry": "flake-registry",
         "git-hooks": "git-hooks",
         "home-manager": "home-manager",
+        "homelab-svg-assets": "homelab-svg-assets",
         "impermanence": "impermanence",
         "mailserver": "mailserver",
         "minecraft": "minecraft",
diff --git a/flake.nix b/flake.nix
index 484f94b..f0a1fc2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -94,6 +94,10 @@
         pre-commit-hooks.follows = "git-hooks";
       };
     };
+    homelab-svg-assets = {
+      url = "github:loganmarchione/homelab-svg-assets";
+      flake = false;
+    };
 
     xmonad-ng = {
       url = "git+https://git.azahi.cc/xmonad-ng?ref=master";
diff --git a/media/k3s.svg b/media/k3s.svg
deleted file mode 100644
index 555284b..0000000
--- a/media/k3s.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path d="M114.434 11.875H13.547C6.074 11.898.023 17.949 0 25.422v77.719c.023 7.472 6.074 13.523 13.547 13.546h100.887c7.472-.023 13.523-6.074 13.546-13.546V25.42c-.023-7.472-6.074-13.523-13.546-13.546zM54.078 88.094l-24.621 14.308a6.592 6.592 0 01-9.008-2.386 6.59 6.59 0 012.387-9.008l24.621-14.309a6.587 6.587 0 019.012 2.383 6.593 6.593 0 01-2.39 9.012zm9.688-21.801h-.032a6.59 6.59 0 01-6.558-6.617l.125-28.364a6.587 6.587 0 016.586-6.562h.031a6.59 6.59 0 016.559 6.617l-.125 28.367a6.588 6.588 0 01-6.586 6.559zm43.562 33.703a6.585 6.585 0 01-9 2.41L73.672 88.172a6.589 6.589 0 116.59-11.41l24.656 14.234a6.586 6.586 0 012.41 9zm0 0" fill="#ffc519"/></svg>
diff --git a/modules/alertmanager.nix b/modules/alertmanager.nix
index 022f631..e5366e5 100644
--- a/modules/alertmanager.nix
+++ b/modules/alertmanager.nix
@@ -3,7 +3,6 @@
   inputs,
   lib,
   libNginx,
-  pkgs,
   this,
   ...
 }:
@@ -90,10 +89,7 @@ in
     topology = with cfg; {
       nodes.${this.hostname}.services.alertmanager = {
         name = "Alertmanager";
-        icon = pkgs.fetchurl {
-          url = "https://www.svgrepo.com/download/354219/prometheus.svg";
-          sha256 = "sha256-4n3v95vfHYz65Hh/8BeRf4T++EGdOLKHuwVuusYt9dc=";
-        };
+        icon = "${inputs.homelab-svg-assets}/assets/prometheus.svg";
         info = domain;
         details.listen.text = "127.0.0.1:${toString port}";
       };
diff --git a/modules/clickhouse.nix b/modules/clickhouse.nix
index 12dc7fa..6bb53bb 100644
--- a/modules/clickhouse.nix
+++ b/modules/clickhouse.nix
@@ -1,4 +1,10 @@
-{ config, lib, ... }:
+{
+  config,
+  inputs,
+  lib,
+  this,
+  ...
+}:
 with lib;
 let
   cfg = config.nixfiles.modules.clickhouse;
@@ -12,5 +18,13 @@ in
     services.clickhouse = {
       enable = true;
     };
+
+    topology = {
+      nodes.${this.hostname}.services.clickhouse = {
+        name = "ClickHouse";
+        icon = "${inputs.homelab-svg-assets}/assets/postgresql.svg";
+        details.listen.text = "127.0.0.1:8123";
+      };
+    };
   };
 }
diff --git a/modules/ipfs.nix b/modules/ipfs.nix
index cd28372..1dad6a6 100644
--- a/modules/ipfs.nix
+++ b/modules/ipfs.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   libNginx,
   this,
@@ -23,12 +24,22 @@ in
       default = "ipfs.${config.networking.fqdn}";
     };
 
+    gatewayBind = mkOption {
+      description = "Gateway bind.";
+      type = with types; str;
+      default = "127.0.0.1";
+    };
     gatewayPort = mkOption {
       description = "Gateway port.";
       type = with types; port;
       default = if this.isHeadless then gatewayDefaultPort + 990 else gatewayDefaultPort;
     };
 
+    apiBind = mkOption {
+      description = "API bind.";
+      type = with types; str;
+      default = "127.0.0.1";
+    };
     apiPort = mkOption {
       description = "API port.";
       type = with types; port;
@@ -85,8 +96,8 @@ in
             in
             {
               Addresses = {
-                API = "/ip4/127.0.0.1/tcp/${toString cfg.apiPort}";
-                Gateway = "/ip4/127.0.0.1/tcp/${toString cfg.gatewayPort}";
+                API = "/ip4/${cfg.apiBind}/tcp/${toString cfg.apiPort}";
+                Gateway = "/ip4/${cfg.gatewayBind}/tcp/${toString cfg.gatewayPort}";
                 Swarm =
                   let
                     port = toString cfg.swarmPort;
@@ -118,13 +129,24 @@ in
         allowedTCPPorts = [ swarmDefaultPort ];
         allowedUDPPorts = allowedTCPPorts;
       };
+
+      topology = with cfg; {
+        nodes.${this.hostname}.services.ipfs-kubo = {
+          name = "IPFS Kubo";
+          icon = "${inputs.homelab-svg-assets}/assets/ipfs.svg";
+          details.listen.text = ''
+            ${gatewayBind}:${toString gatewayPort}
+            ${apiBind}:${toString apiPort}
+          '';
+        };
+      };
     }
     (mkIf this.isHeadless {
       nixfiles.modules.nginx = {
         enable = true;
         upstreams = with cfg; {
-          kubo_gateway.servers."127.0.0.1:${toString gatewayPort}" = { };
-          kubo_api.servers."127.0.0.1:${toString apiPort}" = { };
+          kubo_gateway.servers."${gatewayBind}:${toString gatewayPort}" = { };
+          kubo_api.servers."${apiBind}:${toString apiPort}" = { };
         };
         virtualHosts = {
           ${cfg.domain} = {
@@ -140,6 +162,8 @@ in
           };
         };
       };
+
+      topology.nodes.${this.hostname}.services.ipfs-kubo.info = cfg.domain;
     })
   ]);
 }
diff --git a/modules/jackett.nix b/modules/jackett.nix
index 492e77a..07a5b16 100644
--- a/modules/jackett.nix
+++ b/modules/jackett.nix
@@ -1,7 +1,9 @@
 {
   config,
+  inputs,
   lib,
   libNginx,
+  this,
   ...
 }:
 with lib;
@@ -32,5 +34,14 @@ in
     };
 
     services.jackett.enable = true;
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.jackett = {
+        name = "Jackett";
+        icon = "${inputs.homelab-svg-assets}/assets/jackett.svg";
+        info = domain;
+        details.listen.text = "127.0.0.1:9117";
+      };
+    };
   };
 }
diff --git a/modules/k3s.nix b/modules/k3s.nix
index 01c77dd..9c8f512 100644
--- a/modules/k3s.nix
+++ b/modules/k3s.nix
@@ -65,7 +65,7 @@ in
     topology = {
       nodes.${this.hostname}.services.k3s = {
         name = "K3s";
-        icon = "${inputs.self}/media/k3s.svg";
+        icon = "${inputs.homelab-svg-assets}/assets/k3s.svg";
       };
     };
   };
diff --git a/modules/lidarr.nix b/modules/lidarr.nix
index 84d363b..127e8d9 100644
--- a/modules/lidarr.nix
+++ b/modules/lidarr.nix
@@ -3,6 +3,7 @@
   inputs,
   lib,
   libNginx,
+  this,
   ...
 }:
 with lib;
@@ -56,5 +57,12 @@ in
     systemd.tmpfiles.rules = with config.services.lidarr; [
       "d /var/lib/lidarr/root 0755 ${user} ${group} - -"
     ];
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.lidarr = {
+        info = domain;
+        details.listen.text = "127.0.0.1:8686";
+      };
+    };
   };
 }
diff --git a/modules/loki.nix b/modules/loki.nix
index c446848..75e534b 100644
--- a/modules/loki.nix
+++ b/modules/loki.nix
@@ -2,6 +2,7 @@
   config,
   lib,
   libNginx,
+  this,
   ...
 }:
 with lib;
@@ -120,5 +121,11 @@ in
       "d ${storage.filesystem.chunks_directory} 0700 loki loki - -"
       "d ${storage.filesystem.rules_directory} 0700 loki loki - -"
     ];
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.loki = {
+        info = domain;
+      };
+    };
   };
 }
diff --git a/modules/matrix/dendrite.nix b/modules/matrix/dendrite.nix
index dafef00..c391ba0 100644
--- a/modules/matrix/dendrite.nix
+++ b/modules/matrix/dendrite.nix
@@ -1,8 +1,9 @@
 {
   config,
-  lib,
   inputs,
+  lib,
   pkgs,
+  this,
   ...
 }:
 with lib;
@@ -235,5 +236,14 @@ in
             ];
           };
       };
+
+      topology = with cfg; {
+        nodes.${this.hostname}.services.dendrite = {
+          name = "Dendrite";
+          icon = "${inputs.homelab-svg-assets}/assets/matrix-white.svg";
+          info = domain;
+          details.listen.text = "127.0.0.1:${toString port}";
+        };
+      };
     };
 }
diff --git a/modules/nsd.nix b/modules/nsd.nix
index f44a2a0..9adc084 100644
--- a/modules/nsd.nix
+++ b/modules/nsd.nix
@@ -225,5 +225,15 @@ in
       allowedTCPPorts = [ 53 ];
       allowedUDPPorts = allowedTCPPorts;
     };
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.nsd = {
+        name = "NSD";
+        icon = "${inputs.homelab-svg-assets}/assets/unbound.svg";
+        details.listen.text = concatMapStringsSep "\n" (i: "${i}:53") (
+          filter (i: i != "127.0.0.1" && i != "::1") config.services.nsd.interfaces
+        );
+      };
+    };
   };
 }
diff --git a/modules/ntfy.nix b/modules/ntfy.nix
index 5739855..e3de72e 100644
--- a/modules/ntfy.nix
+++ b/modules/ntfy.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   libNginx,
   this,
@@ -76,5 +77,14 @@ in
           optionalString cfg.prometheus.enable "${address}:${toString port}";
       };
     };
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.ntfy = {
+        name = "ntfy";
+        icon = "${inputs.homelab-svg-assets}/assets/ntfy.svg";
+        info = domain;
+        details.listen.text = config.services.ntfy-sh.settings.listen-http;
+      };
+    };
   };
 }
diff --git a/modules/plausible.nix b/modules/plausible.nix
index d63e3ab..c5b66c3 100644
--- a/modules/plausible.nix
+++ b/modules/plausible.nix
@@ -2,6 +2,7 @@
   config,
   inputs,
   lib,
+  this,
   ...
 }:
 with lib;
@@ -125,5 +126,14 @@ in
         ];
         requires = after;
       };
+
+      topology = with cfg; {
+        nodes.${this.hostname}.services.plausible = {
+          name = "Plausible";
+          icon = "${inputs.homelab-svg-assets}/assets/plausible.svg";
+          info = domain;
+          details.listen.text = "${config.services.plausible.server.listenAddress}:${toString port}";
+        };
+      };
     };
 }
diff --git a/modules/postgresql.nix b/modules/postgresql.nix
index 5081340..f9ea64f 100644
--- a/modules/postgresql.nix
+++ b/modules/postgresql.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   pkgs,
   this,
@@ -94,5 +95,13 @@ in
         \unset QUIET
       ''
     );
+
+    topology = {
+      nodes.${this.hostname}.services.postgresql = {
+        name = "PostgreSQL";
+        icon = "${inputs.homelab-svg-assets}/assets/postgresql.svg";
+        details.listen.text = "127.0.0.1:5432";
+      };
+    };
   };
 }
diff --git a/modules/prometheus.nix b/modules/prometheus.nix
index 9f28cd5..673f288 100644
--- a/modules/prometheus.nix
+++ b/modules/prometheus.nix
@@ -1,7 +1,9 @@
 {
   config,
+  inputs,
   lib,
   libNginx,
+  this,
   ...
 }:
 with lib;
@@ -49,5 +51,14 @@ in
         "--storage.tsdb.wal-compression"
       ];
     };
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.prometheus = {
+        name = "Prometheus";
+        icon = "${inputs.homelab-svg-assets}/assets/prometheus.svg";
+        info = domain;
+        details.listen.text = "127.0.0.1:${toString port}";
+      };
+    };
   };
 }
diff --git a/modules/unbound.nix b/modules/unbound.nix
index e71d48c..d10096d 100644
--- a/modules/unbound.nix
+++ b/modules/unbound.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   pkgs,
   this,
@@ -221,5 +222,15 @@ in
       };
 
       boot.kernel.sysctl."net.ipv4.tcp_fastopen" = mkOverride 200 3;
+
+      topology = with cfg; {
+        nodes.${this.hostname}.services.unbound = {
+          name = "Unbound";
+          icon = "${inputs.homelab-svg-assets}/assets/unbound.svg";
+          details.listen.text = concatMapStringsSep "\n" (i: "${i}:53") (
+            filter (i: i != "127.0.0.1" && i != "::1") config.services.unbound.settings.server.interface
+          );
+        };
+      };
     };
 }
diff --git a/modules/vaultwarden.nix b/modules/vaultwarden.nix
index 2cacb6c..edce8e5 100644
--- a/modules/vaultwarden.nix
+++ b/modules/vaultwarden.nix
@@ -2,6 +2,7 @@
   config,
   inputs,
   lib,
+  this,
   ...
 }:
 with lib;
@@ -141,5 +142,11 @@ in
           };
         };
       };
+
+      topology = with cfg; {
+        nodes.${this.hostname}.services.vaultwarden = {
+          info = mkForce domain;
+        };
+      };
     };
 }

Consider giving Nix/NixOS a try! <3