In the python flask example application given on https://nixos.org/guides/dev-environment.html ... Isn't it just killing the daemon process whether it passes the health check or not? Maybe there's something implicit going on that I'm not grasping?
You can also run a bash script like this one in your CI to make sure your default.nix keeps working in the future.
#!/usr/bin/env nix-shell
#! nix-shell -i bash
set -euo pipefail
# start myapp in background and save the process id
python myapp.py >> /dev/null 2>&1 &
pid=$!
# ok so we have the pid
if [[ $(curl --retry 3 --retry-delay 1 --retry-connrefused http://127.0.0.1:5000) == "Hello, Nix!" ]]; then
echo "SUCCESS: myapp.py is serving the expected string"
# and if the health check runs successfully, we kill the python process
kill $pid
exit 0
else
echo "FAIL: myapp.py is not serving the expected string"
# and if the health check fails, we kill the python process
kill $pid
exit 1
fi