about summary refs log tree commit diff
path: root/modules/services/grafana
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services/grafana')
-rw-r--r--modules/services/grafana/default.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix
index 20d5a19..bcb52e2 100644
--- a/modules/services/grafana/default.nix
+++ b/modules/services/grafana/default.nix
@@ -5,6 +5,11 @@ let
 in {
   options.my.services.grafana = with lib; {
     enable = mkEnableOption "grafana observability stack";
+    vhostName = mkOption {
+      type = types.str;
+      example = "dash.fcuny.net";
+      description = "Name for the virtual host";
+    };
   };
 
   config = lib.mkIf cfg.enable {
@@ -27,16 +32,18 @@ in {
       };
     };
 
-    services.nginx.virtualHosts."dash.fcuny.xyz" = {
+    services.nginx.virtualHosts."${cfg.vhostName}" = {
       forceSSL = true;
-      useACMEHost = "dash.fcuny.xyz";
+      useACMEHost = cfg.vhostName;
       locations."/" = {
-        proxyPass = "http://127.0.0.1:3000";
+        proxyPass = "http://${config.services.grafana.addr}:${
+            toString config.services.grafana.port
+          }";
         proxyWebsockets = true;
       };
     };
 
-    security.acme.certs."dash.fcuny.xyz" = {
+    security.acme.certs."${cfg.vhostName}" = {
       dnsProvider = "gcloud";
       credentialsFile = secrets."acme/credentials".path;
     };