aboutsummaryrefslogtreecommitdiff
path: root/modules/network
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-06-13 21:50:54 +0530
committerAkshay Nair <phenax5@gmail.com>2025-06-13 21:50:54 +0530
commite11b9a851851bb47109545093e3accdbcab76859 (patch)
treee733232829ccca32d6ff3cfc88e4794222448676 /modules/network
parent6df186662a37b17015959bf0d6b456ab282b1826 (diff)
downloadhomeserver-nixos-config-e11b9a851851bb47109545093e3accdbcab76859.tar.gz
homeserver-nixos-config-e11b9a851851bb47109545093e3accdbcab76859.zip
Add grafana+prometheus + embed into dashboard
Diffstat (limited to 'modules/network')
-rw-r--r--modules/network/default.nix1
-rw-r--r--modules/network/service-router.service.nix19
2 files changed, 13 insertions, 7 deletions
diff --git a/modules/network/default.nix b/modules/network/default.nix
index 55a4c43..f6263f5 100644
--- a/modules/network/default.nix
+++ b/modules/network/default.nix
@@ -22,6 +22,7 @@ in
"lidarr.local" = { inherit host; port = ports.lidarr; };
"git.local" = { inherit host; port = 80; basePath = "/gitweb/"; };
"ntfy.local" = { inherit host; port = ports.ntfy; };
+ "grafana.local" = { inherit host; port = ports.grafana; extraOptions.recommendedProxySettings = true; };
};
};
diff --git a/modules/network/service-router.service.nix b/modules/network/service-router.service.nix
index 3d0b6e7..14fc1b2 100644
--- a/modules/network/service-router.service.nix
+++ b/modules/network/service-router.service.nix
@@ -21,6 +21,7 @@ in {
protocol = mkOption { type = types.str; default = "http"; };
basePath = mkOption { type = types.str; default = ""; };
nginx = mkOption { type = types.attrs; default = {}; };
+ extraOptions = mkOption { type = types.attrs; default = {}; };
}; });
default = {};
};
@@ -30,13 +31,17 @@ in {
services.nginx = {
enable = true;
recommendedOptimisation = true;
- virtualHosts = lib.mapAttrs (_: val: {
- locations."/" = if val.nginx == {} then {
- proxyPass =
- "${val.protocol}://${val.host}:${toString val.port}${val.basePath}";
- proxyWebsockets = true;
- } else val.nginx;
- }) cfg.routes;
+ virtualHosts = lib.mapAttrs (_: val:
+ let
+ opts = if hasAttr "extraOptions" val then val.extraOptions else {};
+ in {
+ locations."/" = if val.nginx == {} then {
+ proxyPass =
+ "${val.protocol}://${val.host}:${toString val.port}${val.basePath}";
+ proxyWebsockets = true;
+ } // opts else val.nginx;
+ }
+ ) cfg.routes;
};
services.nsd = {