about summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorFelix Buehler <account@buehler.rocks>2024-01-26 23:10:57 +0100
committerFelix Buehler <account@buehler.rocks>2024-01-26 23:10:57 +0100
commitbdce5312c9458eff44132647867dd55397ba09b1 (patch)
tree6d96a5a14d9e4c368c3ce12df48d6482f4415603 /nixos/modules/services/monitoring
parent1aa4e31045559f9edf650503363fd5390e1066be (diff)
downloadnixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar.gz
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar.bz2
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar.lz
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar.xz
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.tar.zst
nixlib-bdce5312c9458eff44132647867dd55397ba09b1.zip
nixos/{zabbixServer,zabbixProxy}: prefer 'install' over 'mkdir/chmod/chown'
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/zabbix-proxy.nix5
-rw-r--r--nixos/modules/services/monitoring/zabbix-server.nix5
2 files changed, 2 insertions, 8 deletions
diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix
index 503e81b48a58..fea5704af6f6 100644
--- a/nixos/modules/services/monitoring/zabbix-proxy.nix
+++ b/nixos/modules/services/monitoring/zabbix-proxy.nix
@@ -299,10 +299,7 @@ in
         fi
       '' + optionalString (cfg.database.passwordFile != null) ''
         # create a copy of the supplied password file in a format zabbix can consume
-        touch ${passwordFile}
-        chmod 0600 ${passwordFile}
-        echo -n "DBPassword = " > ${passwordFile}
-        cat ${cfg.database.passwordFile} >> ${passwordFile}
+        install -m 0600 <(echo "DBPassword = $(cat ${cfg.database.passwordFile})") ${passwordFile}
       '';
 
       serviceConfig = {
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 0607188d2131..f2fb5fbe7ac6 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -292,10 +292,7 @@ in
         fi
       '' + optionalString (cfg.database.passwordFile != null) ''
         # create a copy of the supplied password file in a format zabbix can consume
-        touch ${passwordFile}
-        chmod 0600 ${passwordFile}
-        echo -n "DBPassword = " > ${passwordFile}
-        cat ${cfg.database.passwordFile} >> ${passwordFile}
+        install -m 0600 <(echo "DBPassword = $(cat ${cfg.database.passwordFile})") ${passwordFile}
       '';
 
       serviceConfig = {