diff --git a/.github/workflows/nix-interop.yml b/.github/workflows/nix-interop.yml index 750aec90..850cdeae 100644 --- a/.github/workflows/nix-interop.yml +++ b/.github/workflows/nix-interop.yml @@ -51,6 +51,30 @@ jobs: experimental-features = nix-command flakes accept-flake-config = false + - name: Wait for the Nix store to become ready + shell: bash + run: | + set -euo pipefail + if [[ "$RUNNER_OS" != "macOS" ]]; then + nix store ping + exit 0 + fi + + for attempt in $(seq 1 20); do + if NIX_REMOTE=daemon nix store ping >/dev/null 2>&1; then + printf 'NIX_REMOTE=daemon\n' >> "$GITHUB_ENV" + exit 0 + fi + echo "Nix daemon is not ready yet (attempt ${attempt}/20)" >&2 + sudo launchctl kickstart -k system/org.nixos.nix-daemon >/dev/null 2>&1 || true + sleep 2 + done + + sudo launchctl print system/org.nixos.nix-daemon || true + ls -la /nix/var/nix/daemon-socket || true + echo "Nix daemon did not become ready" >&2 + exit 1 + - name: Load the locked Nixpkgs input shell: bash run: | @@ -308,7 +332,7 @@ jobs: flags=re.MULTILINE, ) if count != 1: - raise SystemExit("expected one locked artifact sha256 to tamper") + raise SystemExit("expected one locked artifact sha256 to tamper") path.write_text(text, encoding="utf-8") PY