Skip to content

Commit 1742f8e

Browse files
committed
guix: Add early health check for guix-daemon
1 parent c1ae726 commit 1742f8e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

contrib/guix/guix-build

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,33 @@ for host in $HOSTS; do
130130
esac
131131
done
132132

133+
################
134+
# Check that we can connect to the guix-daemon
135+
################
136+
137+
cat << EOF
138+
Checking that we can connect to the guix-daemon...
139+
140+
Hint: If this hangs, you may want to try turning your guix-daemon off and on
141+
again.
142+
143+
EOF
144+
if ! guix gc --list-failures > /dev/null; then
145+
cat << EOF
146+
147+
ERR: Failed to connect to the guix-daemon, please ensure that one is running and
148+
reachable.
149+
EOF
150+
exit 1
151+
fi
152+
153+
# Developer note: we could use `guix repl` for this check and run:
154+
#
155+
# (import (guix store)) (close-connection (open-connection))
156+
#
157+
# However, the internal API is likely to change more than the CLI invocation
158+
159+
133160
#########
134161
# SETUP #
135162
#########

0 commit comments

Comments
 (0)