From e2cebf2134ff2128b312bf018d450b1ba9b1f30b Mon Sep 17 00:00:00 2001 From: Izorkin Date: Mon, 15 Feb 2021 18:44:38 +0300 Subject: [PATCH] nixos/mastodon: fix init db on remote postgresql --- nixos/modules/services/web-apps/mastodon.nix | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix index a6cd7432db24..fcfaf3bb57c1 100644 --- a/nixos/modules/services/web-apps/mastodon.nix +++ b/nixos/modules/services/web-apps/mastodon.nix @@ -530,7 +530,16 @@ in { }; systemd.services.mastodon-init-db = lib.mkIf cfg.automaticMigrations { - script = '' + script = lib.optionalString (!databaseActuallyCreateLocally) '' + umask 077 + + export PGPASSFILE + PGPASSFILE=$(mktemp) + cat > $PGPASSFILE <