From 3c61dc9cc35ed201877d81b1b7ad848f1ac9855e Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Thu, 2 May 2024 14:30:08 +0300 Subject: 2024-05-02 --- media/k3s.svg | 1 + modules/alertmanager.nix | 14 ++++++++++++++ modules/grafana.nix | 3 +++ modules/k3s.nix | 9 +++++++++ modules/shadowsocks.nix | 12 ++++++++++++ modules/wireguard.nix | 3 +-- 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 media/k3s.svg 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 @@ + 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); }; }) -- cgit 1.4.1