From 870948306dc4fd33df78124e50b8a261af74d88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 14 Jun 2024 11:14:49 +0200 Subject: [PATCH] postgres: handle restores without associated systemd service --- clanModules/postgresql/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clanModules/postgresql/default.nix b/clanModules/postgresql/default.nix index 215b7fec4..185929881 100644 --- a/clanModules/postgresql/default.nix +++ b/clanModules/postgresql/default.nix @@ -159,8 +159,12 @@ in if [[ -e "${current}" ]]; then ( - systemctl stop ${lib.concatStringsSep " " db.restore.stopOnRestore} - trap "systemctl start ${lib.concatStringsSep " " db.restore.stopOnRestore}" EXIT + ${ + lib.optionalString (db.restore.stopOnRestore != [ ]) '' + systemctl stop ${builtins.toString db.restore.stopOnRestore} + trap "systemctl start ${builtins.toString db.restore.stopOnRestore}" EXIT + '' + } mkdir -p "${folder}" runuser -u postgres -- dropdb "${db.name}"