From 87aff6707b2d031f7d3af612d3c37a749519a395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Barnouin?= Date: Wed, 25 Sep 2024 13:44:15 +0200 Subject: [PATCH] Fix variable --- flake.nix | 7 +++++-- services/grafana/default.nix | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 022697e..0815ffa 100644 --- a/flake.nix +++ b/flake.nix @@ -79,6 +79,7 @@ inherit inputs; inherit username; inherit proxy_host; + inherit pgsql_host; inherit system; }; }; @@ -115,6 +116,7 @@ inherit inputs; inherit username; inherit proxy_host; + inherit pgsql_host; inherit system; }; }; @@ -131,7 +133,7 @@ services.vm = { enable = true; hostname = "nginx"; - vm_ip = "192.168.1.40"; + vm_ip = proxy_host; macAddr = "02:00:00:00:00:40"; }; } @@ -186,7 +188,8 @@ { services.vm_grafana = { enable = true; - proxy_ip = "192.168.1.40"; + proxy_ip = proxy_host; + pgsql_ip = pgsql_host; }; services.vm = { enable = true; diff --git a/services/grafana/default.nix b/services/grafana/default.nix index b07201e..618251c 100644 --- a/services/grafana/default.nix +++ b/services/grafana/default.nix @@ -9,6 +9,10 @@ in type = lib.types.str; description = "The Nginx proxy IP address"; }; + pgsql_ip = lib.mkOption { + type = lib.types.str; + description = "The PostgreSQL host IP address"; + }; }; config = lib.mkIf cfg.enable { services.rsyslogd.enable = true; @@ -25,7 +29,7 @@ in }; database = { type = "postgres"; - host = "${cfg.pgsql_host}:5432"; + host = "${cfg.pgsql_ip}:5432"; name = "grafana"; user = "grafana"; password = "\$__file{/run/secrets/grafana/database_secret}";