about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-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
5 files changed, 39 insertions, 2 deletions
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