From cf3e31dcf0e0c753560a8ecc29782f3d9762f5f9 Mon Sep 17 00:00:00 2001 From: Ameer Taweel Date: Sun, 19 Apr 2026 01:11:44 +0300 Subject: [PATCH] nixos/prometheus: remove absolute path literals --- .../services/monitoring/prometheus/exporters.nix | 2 +- .../monitoring/prometheus/exporters/blackbox.nix | 11 ++++------- .../monitoring/prometheus/exporters/ecoflow.nix | 12 ++++++------ .../monitoring/prometheus/exporters/snmp.nix | 11 ++++------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index a6317a032235..0d184c3e6e8e 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -386,7 +386,7 @@ let after = [ "network.target" ]; serviceConfig.Restart = mkDefault "always"; serviceConfig.PrivateTmp = mkDefault true; - serviceConfig.WorkingDirectory = mkDefault /tmp; + serviceConfig.WorkingDirectory = mkDefault "/tmp"; serviceConfig.DynamicUser = mkDefault enableDynamicUser; serviceConfig.User = mkDefault conf.user; serviceConfig.Group = conf.group; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix b/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix index c053fc5417c1..55847902aa05 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix @@ -23,13 +23,10 @@ let if (builtins.isPath file) || (lib.isStorePath file) then file else - ( - lib.warn '' - ${logPrefix}: configuration file "${file}" is being copied to the nix-store. - If you would like to avoid that, please set enableConfigCheck to false. - '' /. - + file - ); + (lib.warn '' + ${logPrefix}: configuration file "${file}" is being copied to the nix-store. + If you would like to avoid that, please set enableConfigCheck to false. + '' (builtins.toFile (builtins.baseNameOf file) (builtins.readFile file))); checkConfigLocation = file: if lib.hasPrefix "/tmp/" file then diff --git a/nixos/modules/services/monitoring/prometheus/exporters/ecoflow.nix b/nixos/modules/services/monitoring/prometheus/exporters/ecoflow.nix index d95a3867fdcc..22cc859013f6 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/ecoflow.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/ecoflow.nix @@ -27,7 +27,7 @@ in }; ecoflowAccessKeyFile = mkOption { type = types.path; - default = /etc/ecoflow-access-key; + default = "/etc/ecoflow-access-key"; description = '' Path to the file with your personal api access string from the Ecoflow development website . Do to share or commit your plaintext scecrets to a public repo use: agenix or soaps. @@ -35,7 +35,7 @@ in }; ecoflowSecretKeyFile = mkOption { type = types.path; - default = /etc/ecoflow-secret-key; + default = "/etc/ecoflow-secret-key"; description = '' Path to the file with your personal api secret string from the Ecoflow development website . Do to share or commit your plaintext scecrets to a public repo use: agenix or soaps. @@ -43,7 +43,7 @@ in }; ecoflowEmailFile = mkOption { type = types.path; - default = /etc/ecoflow-email; + default = "/etc/ecoflow-email"; description = '' Path to the file with your personal ecoflow app login email address. Do to share or commit your plaintext scecrets to a public repo use: agenix or soaps. @@ -51,7 +51,7 @@ in }; ecoflowPasswordFile = mkOption { type = types.path; - default = /etc/ecoflow-password; + default = "/etc/ecoflow-password"; description = '' Path to the file with your personal ecoflow app login email password. Do to share or commit your plaintext passwords to a public repo use: agenix or soaps here! @@ -59,7 +59,7 @@ in }; ecoflowDevicesFile = mkOption { type = types.path; - default = /etc/ecoflow-devices; + default = "/etc/ecoflow-devices"; description = '' File must contain one line, example: R3300000,R3400000,NC430000,.... The list of devices serial numbers separated by comma. For instance: SN1,SN2,SN3. @@ -69,7 +69,7 @@ in }; ecoflowDevicesPrettyNamesFile = mkOption { type = types.path; - default = /etc/ecoflow-devices-pretty-names; + default = "/etc/ecoflow-devices-pretty-names"; description = '' File must contain one line, example: {"R3300000":"Delta 2","R3400000":"Delta Pro",...} The key/value map of custom names for your devices. Key is a serial number, value is a device name you want diff --git a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix index b65c73d2dec7..768d27b0fdeb 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix @@ -24,13 +24,10 @@ let if (builtins.isPath file) || (lib.isStorePath file) then file else - ( - lib.warn '' - ${logPrefix}: configuration file "${file}" is being copied to the nix-store. - If you would like to avoid that, please set enableConfigCheck to false. - '' /. - + file - ); + (lib.warn '' + ${logPrefix}: configuration file "${file}" is being copied to the nix-store. + If you would like to avoid that, please set enableConfigCheck to false. + '' (builtins.toFile (builtins.baseNameOf file) (builtins.readFile file))); checkConfig = file: