about summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-12-05 22:36:38 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:42:24 +0100
commit9407761763a61a4f0551c43aa3b818d7ede1fa39 (patch)
treea13ad016a080781077e9f55698d39fcb8fe06b95 /nixos/modules/services/monitoring
parent3226c5aded7bbe52cadf323eb45d3db83408ec6c (diff)
downloadnixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar.gz
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar.bz2
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar.lz
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar.xz
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.tar.zst
nixlib-9407761763a61a4f0551c43aa3b818d7ede1fa39.zip
treewide: add defaultText for options using other shortcut bindings
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/zabbix-proxy.nix8
-rw-r--r--nixos/modules/services/monitoring/zabbix-server.nix8
2 files changed, 14 insertions, 2 deletions
diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix
index b5009f47f175..0ebd7bcff834 100644
--- a/nixos/modules/services/monitoring/zabbix-proxy.nix
+++ b/nixos/modules/services/monitoring/zabbix-proxy.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
 
 let
   cfg = config.services.zabbixProxy;
+  opt = options.services.zabbixProxy;
   pgsql = config.services.postgresql;
   mysql = config.services.mysql;
 
@@ -103,6 +104,11 @@ in
         port = mkOption {
           type = types.int;
           default = if cfg.database.type == "mysql" then mysql.port else pgsql.port;
+          defaultText = literalExpression ''
+            if config.${opt.database.type} == "mysql"
+            then config.${options.services.mysql.port}
+            else config.${options.services.postgresql.port}
+          '';
           description = "Database host port.";
         };
 
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 0141c073da25..9f960517a81b 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
 
 let
   cfg = config.services.zabbixServer;
+  opt = options.services.zabbixServer;
   pgsql = config.services.postgresql;
   mysql = config.services.mysql;
 
@@ -95,6 +96,11 @@ in
         port = mkOption {
           type = types.int;
           default = if cfg.database.type == "mysql" then mysql.port else pgsql.port;
+          defaultText = literalExpression ''
+            if config.${opt.database.type} == "mysql"
+            then config.${options.services.mysql.port}
+            else config.${options.services.postgresql.port}
+          '';
           description = "Database host port.";
         };