summaryrefslogtreecommitdiff
path: root/modules
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 /modules
parent3cd3233f7eaf2a8a715d587820d6d4577a24d958 (diff)
2024-05-05
Diffstat (limited to 'modules')
-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
15 files changed, 150 insertions, 12 deletions
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;
+ };
+ };
};
}