diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/network/default.nix | 1 | ||||
| -rw-r--r-- | modules/network/service-router.service.nix | 19 |
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 = { |
