about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2024-05-01 23:04:29 +0200
committerGitHub <noreply@github.com>2024-05-01 23:04:29 +0200
commit6ca53cb409f28ae4959230f7ea3b3a8ce233d8d5 (patch)
tree720598e60b4a342f1ee2b5fdb0e874278a135003 /nixos
parentd10184dee244bc14782ca5505c4c5118a9eab5d5 (diff)
parenta181e098c90c19e55979bb6776f70953c9120deb (diff)
Merge pull request #308092 from Stunkymonkey/mailman-chmod-install
nixos/mailman: prefer 'install' over 'chmod/chown'
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/mail/mailman.nix11
1 files changed, 4 insertions, 7 deletions
diff --git a/nixos/modules/services/mail/mailman.nix b/nixos/modules/services/mail/mailman.nix
index 7e7ca7e4060ec..180c9800d7345 100644
--- a/nixos/modules/services/mail/mailman.nix
+++ b/nixos/modules/services/mail/mailman.nix
@@ -534,14 +534,11 @@ in {
               hyperkittyApiKey=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 64)
               secretKey=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 64)
 
-              mailmanWebCfgTmp=$(mktemp)
-              jq -n '.MAILMAN_ARCHIVER_KEY=$archiver_key | .SECRET_KEY=$secret_key' \
+              install -m 0440 -o root -g mailman \
+                <(jq -n '.MAILMAN_ARCHIVER_KEY=$archiver_key | .SECRET_KEY=$secret_key' \
                   --arg archiver_key "$hyperkittyApiKey" \
-                  --arg secret_key "$secretKey" \
-                  >"$mailmanWebCfgTmp"
-              chown root:mailman "$mailmanWebCfgTmp"
-              chmod 440 "$mailmanWebCfgTmp"
-              mv -n "$mailmanWebCfgTmp" "$mailmanWebCfg"
+                  --arg secret_key "$secretKey") \
+                "$mailmanWebCfg"
           fi
 
           hyperkittyApiKey="$(jq -r .MAILMAN_ARCHIVER_KEY "$mailmanWebCfg")"