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 21:28:49 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:13:48 +0100
commitfb0e5be84331188a69b3edd31679ca6576edb75a (patch)
tree80d713f568ae02e4a3aed70114bafe46e9fe753f /nixos/modules/services/monitoring
parentf6d0b014fe1db9e6edec5485f41a1162136c8a70 (diff)
downloadnixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.gz
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.bz2
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.lz
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.xz
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.zst
nixlib-fb0e5be84331188a69b3edd31679ca6576edb75a.zip
treewide: add defaultText for options with simple interpolation defaults
adds defaultText for all options that use `cfg.*` values in their
defaults, but only for interpolations with no extra processing (other
than toString where necessary)
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/grafana.nix1
-rw-r--r--nixos/modules/services/monitoring/graphite.nix5
2 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix
index 5067047e9690..81fca33f5fec 100644
--- a/nixos/modules/services/monitoring/grafana.nix
+++ b/nixos/modules/services/monitoring/grafana.nix
@@ -404,6 +404,7 @@ in {
       path = mkOption {
         description = "Database path.";
         default = "${cfg.dataDir}/data/grafana.db";
+        defaultText = literalExpression ''"''${config.${opt.dataDir}}/data/grafana.db"'';
         type = types.path;
       };
 
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 4690a252c925..feb952324d44 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
 
 with lib;
 
 let
   cfg = config.services.graphite;
+  opt = options.services.graphite;
   writeTextOrNull = f: t: mapNullable (pkgs.writeTextDir f) t;
 
   dataDir = cfg.dataDir;
@@ -312,12 +313,14 @@ in {
 
       seyrenUrl = mkOption {
         default = "http://localhost:${toString cfg.seyren.port}/";
+        defaultText = literalExpression ''"http://localhost:''${toString config.${opt.seyren.port}}/"'';
         description = "Host where seyren is accessible.";
         type = types.str;
       };
 
       graphiteUrl = mkOption {
         default = "http://${cfg.web.listenAddress}:${toString cfg.web.port}";
+        defaultText = literalExpression ''"http://''${config.${opt.web.listenAddress}}:''${toString config.${opt.web.port}}"'';
         description = "Host where graphite service runs.";
         type = types.str;
       };