about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--media/k3s.svg1
-rw-r--r--modules/alertmanager.nix14
-rw-r--r--modules/grafana.nix3
-rw-r--r--modules/k3s.nix9
-rw-r--r--modules/shadowsocks.nix12
-rw-r--r--modules/wireguard.nix3
6 files changed, 40 insertions, 2 deletions
diff --git a/media/k3s.svg b/media/k3s.svg
new file mode 100644
index 0000000..555284b
--- /dev/null
+++ b/media/k3s.svg
@@ -0,0 +1 @@
+<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 a3457bc..022f631 100644
--- a/modules/alertmanager.nix
+++ b/modules/alertmanager.nix
@@ -3,6 +3,8 @@
   inputs,
   lib,
   libNginx,
+  pkgs,
+  this,
   ...
 }:
 with lib;
@@ -84,5 +86,17 @@ in
       ntfyPriority = "high";
       envFile = "/dev/null";
     };
+
+    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=";
+        };
+        info = domain;
+        details.listen.text = "127.0.0.1:${toString port}";
+      };
+    };
   };
 }
diff --git a/modules/grafana.nix b/modules/grafana.nix
index 233c9e5..b57577d 100644
--- a/modules/grafana.nix
+++ b/modules/grafana.nix
@@ -3,6 +3,7 @@
   inputs,
   lib,
   libNginx,
+  this,
   ...
 }:
 with lib;
@@ -121,5 +122,7 @@ in
           ];
         };
       };
+
+      topology.nodes.${this.hostname}.services.grafana.info = mkForce cfg.domain;
     };
 }
diff --git a/modules/k3s.nix b/modules/k3s.nix
index 1ad99c3..01c77dd 100644
--- a/modules/k3s.nix
+++ b/modules/k3s.nix
@@ -1,7 +1,9 @@
 {
   config,
+  inputs,
   lib,
   pkgs,
+  this,
   ...
 }:
 with lib;
@@ -59,5 +61,12 @@ in
       kubectx
       kubernetes-helm
     ];
+
+    topology = {
+      nodes.${this.hostname}.services.k3s = {
+        name = "K3s";
+        icon = "${inputs.self}/media/k3s.svg";
+      };
+    };
   };
 }
diff --git a/modules/shadowsocks.nix b/modules/shadowsocks.nix
index 670faec..1d55cf5 100644
--- a/modules/shadowsocks.nix
+++ b/modules/shadowsocks.nix
@@ -3,6 +3,7 @@
   inputs,
   lib,
   pkgs,
+  this,
   ...
 }:
 with lib;
@@ -129,5 +130,16 @@ in
       "net.ipv4.tcp_mtu_probing" = 1;
       "net.ipv4.tcp_congestion_control" = "hybla";
     };
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.shadowsocks = {
+        name = "Shadowsocks";
+        icon = pkgs.fetchurl {
+          url = "https://upload.wikimedia.org/wikipedia/commons/f/f5/Shadowsocks-Logo.svg";
+          sha256 = "sha256-NzGt0WQA4NQpMPsOTWgBrghuewxQeDoSe46oTm0f+BY=";
+        };
+        details.listen.text = ":::${toString port}";
+      };
+    };
   };
 }
diff --git a/modules/wireguard.nix b/modules/wireguard.nix
index 6e5bdbc..f408731 100644
--- a/modules/wireguard.nix
+++ b/modules/wireguard.nix
@@ -9,7 +9,6 @@
 with lib;
 let
   cfg = config.nixfiles.modules.wireguard;
-  inherit (config.lib.topology) mkConnection;
 in
 {
   options.nixfiles.modules.wireguard = {
@@ -230,7 +229,7 @@ in
           };
 
           nodes.${this.hostname}.interfaces.${interface}.physicalConnections = mapAttrsToList (
-            name: _: (mkConnection name interface)
+            name: _: config.lib.topology.mkConnection name interface
           ) (filterAttrs (n: v: !v.isOther && n != this.hostname && hasAttr "wireguard" v) my.configurations);
         };
       })

Consider giving Nix/NixOS a try! <3