From bdce5312c9458eff44132647867dd55397ba09b1 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Fri, 26 Jan 2024 23:10:57 +0100 Subject: nixos/{zabbixServer,zabbixProxy}: prefer 'install' over 'mkdir/chmod/chown' --- nixos/modules/services/monitoring/zabbix-proxy.nix | 5 +---- nixos/modules/services/monitoring/zabbix-server.nix | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix index 503e81b48a587..fea5704af6f66 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 0607188d21319..f2fb5fbe7ac66 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 = { -- cgit 1.4.1