From e11b9a851851bb47109545093e3accdbcab76859 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 13 Jun 2025 21:50:54 +0530 Subject: Add grafana+prometheus + embed into dashboard --- modules/network/service-router.service.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'modules/network/service-router.service.nix') 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 = { -- cgit v1.3.1