Fix variable

This commit is contained in:
Théo Barnouin 2024-09-25 13:44:15 +02:00
parent 74e0b67828
commit 87aff6707b
2 changed files with 10 additions and 3 deletions

View file

@ -79,6 +79,7 @@
inherit inputs; inherit inputs;
inherit username; inherit username;
inherit proxy_host; inherit proxy_host;
inherit pgsql_host;
inherit system; inherit system;
}; };
}; };
@ -115,6 +116,7 @@
inherit inputs; inherit inputs;
inherit username; inherit username;
inherit proxy_host; inherit proxy_host;
inherit pgsql_host;
inherit system; inherit system;
}; };
}; };
@ -131,7 +133,7 @@
services.vm = { services.vm = {
enable = true; enable = true;
hostname = "nginx"; hostname = "nginx";
vm_ip = "192.168.1.40"; vm_ip = proxy_host;
macAddr = "02:00:00:00:00:40"; macAddr = "02:00:00:00:00:40";
}; };
} }
@ -186,7 +188,8 @@
{ {
services.vm_grafana = { services.vm_grafana = {
enable = true; enable = true;
proxy_ip = "192.168.1.40"; proxy_ip = proxy_host;
pgsql_ip = pgsql_host;
}; };
services.vm = { services.vm = {
enable = true; enable = true;

View file

@ -9,6 +9,10 @@ in
type = lib.types.str; type = lib.types.str;
description = "The Nginx proxy IP address"; 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 { config = lib.mkIf cfg.enable {
services.rsyslogd.enable = true; services.rsyslogd.enable = true;
@ -25,7 +29,7 @@ in
}; };
database = { database = {
type = "postgres"; type = "postgres";
host = "${cfg.pgsql_host}:5432"; host = "${cfg.pgsql_ip}:5432";
name = "grafana"; name = "grafana";
user = "grafana"; user = "grafana";
password = "\$__file{/run/secrets/grafana/database_secret}"; password = "\$__file{/run/secrets/grafana/database_secret}";