From 4e20db9fcc3252252855035f14098a22445e1725 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 29 Dec 2020 20:08:55 +0000 Subject: [PATCH] totoro: install grafana --- ops/nixos/totoro/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 90f9b867eb..fe11c3233f 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -205,6 +205,27 @@ in { }; }; }; + services.grafana = { + enable = true; + addr = "0.0.0.0"; + domain = "grafana.int.lukegb.com"; + rootUrl = "https://grafana.int.lukegb.com/"; + + extraOptions = let + convertName = name: lib.toUpper (builtins.replaceStrings ["." "-"] ["_" "_"] name); + convertOptionSection = sectionName: lib.mapAttrsToList (name: value: { name = "GF_${convertName sectionName}_${convertName name}"; inherit value; }); + convertOptions = opts: builtins.listToAttrs (builtins.concatLists (lib.mapAttrsToList convertOptionSection opts)); + in convertOptions { + "auth.proxy" = { + enabled = "true"; + header_name = "X-Pomerium-Claim-Email"; + header_property = "email"; + headers = "username:X-Pomerium-Claim-User"; + auto_sign_up = "true"; + }; + security.cookie_secure = "true"; + }; + }; system.stateVersion = "20.03"; }