From 9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 31 Mar 2024 21:29:27 +0300 Subject: 2024-03-31 --- modules/nixos/grafana.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'modules/nixos/grafana.nix') diff --git a/modules/nixos/grafana.nix b/modules/nixos/grafana.nix index 2f32225..233c9e5 100644 --- a/modules/nixos/grafana.nix +++ b/modules/nixos/grafana.nix @@ -5,9 +5,11 @@ libNginx, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.grafana; -in { +in +{ options.nixfiles.modules.grafana = { enable = mkEnableOption "Grafana"; @@ -24,11 +26,12 @@ in { }; }; - config = let - db = "grafana"; - in + config = + let + db = "grafana"; + in mkIf cfg.enable { - ark.directories = [config.services.grafana.dataDir]; + ark.directories = [ config.services.grafana.dataDir ]; secrets = { grafana-key = { @@ -51,7 +54,7 @@ in { nixfiles.modules = { nginx = { enable = true; - upstreams.grafana.servers."127.0.0.1:${toString cfg.port}" = {}; + upstreams.grafana.servers."127.0.0.1:${toString cfg.port}" = { }; virtualHosts.${cfg.domain} = { locations."/" = { proxyPass = "http://grafana"; @@ -109,7 +112,7 @@ in { }; postgresql = { - ensureDatabases = [db]; + ensureDatabases = [ db ]; ensureUsers = [ { name = db; -- cgit 1.4.1