about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2024-04-16 18:40:49 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2024-04-20 20:25:50 +0200
commit0162798a2de95c15ba3c79fbb17e070fcc94beea (patch)
tree47a98f133c1ec5611ea1477a30b72ac898b028a8 /nixos/modules
parent404c2a23509e9cf78b4e11d631bfe65109a3e97b (diff)
nixos/deconz: delay signalling service readiness until it's actually up
Fixes test flakiness (`nix-build -A nixosTests.deconz`).

(cherry picked from commit e99ef7b970bc0b75d96c9659cc547ba44aca49ea)
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/networking/deconz.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/deconz.nix b/nixos/modules/services/networking/deconz.nix
index 05b7247087771..eaa7759d0407c 100644
--- a/nixos/modules/services/networking/deconz.nix
+++ b/nixos/modules/services/networking/deconz.nix
@@ -93,6 +93,13 @@ in
         # be garbage collected. Ensure the file gets "refreshed" on every start.
         rm -f ${stateDir}/.local/share/dresden-elektronik/deCONZ/zcldb.txt
       '';
+      postStart = ''
+        # Delay signalling service readiness until it's actually up.
+        while ! "${lib.getExe pkgs.curl}" -sSfl -o /dev/null "http://${cfg.listenAddress}:${toString cfg.httpPort}"; do
+            echo "Waiting for TCP port ${toString cfg.httpPort} to be open..."
+            sleep 1
+        done
+      '';
       environment = {
         HOME = stateDir;
         XDG_RUNTIME_DIR = "/run/${name}";