From c55600c5af121793dd459f5bab93fb798a6e1c28 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Fri, 29 Dec 2023 19:05:28 +0000 Subject: [PATCH] lib: Make awaitPostgres code early in preStart --- lib/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index e83279f..d950fe6 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -4,7 +4,8 @@ let inherit (lib) genAttrs mapAttrsToList filterAttrsRecursive nameValuePair types mkOption mkOverride mkForce mkIf mergeEqualOption optional - showWarnings concatStringsSep flatten unique optionalAttrs; + showWarnings concatStringsSep flatten unique optionalAttrs + mkBefore; inherit (lib.flake) defaultSystems; in rec { @@ -166,7 +167,7 @@ rec { systemdAwaitPostgres = pkg: host: { after = [ "systemd-networkd-wait-online.service" ]; - preStart = '' + preStart = mkBefore '' until ${pkg}/bin/pg_isready -h ${host}; do sleep 0.5 done