chore(build): make xce-build.sh self-wrap into nix develop

meson/ninja/capnp/Go only exist inside the hermetic nix dev shell, but
xce-build.sh never entered it itself -- the /xce-build skill documented
wrapping every invocation in `nix develop ./src --command ...` by hand,
so a bare `bash src/tools/xce-build.sh ...` (run directly instead of
through the skill) failed opaquely with "meson: command not found". This
was a recurring, previously-logged gap that resurfaced again today mid
bug-1789 verification.

The script now checks IN_NIX_SHELL at the top and re-execs itself under
`nix develop` if unset, so every caller -- the skill, a bare invocation,
CI, a human at a terminal -- gets it automatically. A nested call (already
inside the shell) is a no-op past that check. README.md's daily-develop
section updated to match; the old "or use nix develop --command" example
is now redundant and removed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GLfB5uWRdmx2WiZSFC7Fm7
This commit is contained in:
Rongsong Shen 2026-09-07 15:31:06 +00:00
parent 924ac32c1d
commit 028d8f6ac7
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
8 changed files with 6063 additions and 6025 deletions

View file

@ -1,6 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SRC_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# Self-wrap into the hermetic nix dev shell. meson/ninja/capnp/Go live only
# there; a bare invocation outside it fails opaquely ("meson: command not
# found") well past the point a caller can tell why. Re-exec once under
# `nix develop` -- the same wrapper the /xce-build skill already documents
# running by hand -- so every caller (the skill, a bare `bash xce-build.sh`,
# CI, a human at a terminal) gets it automatically instead of relying on
# remembering it. `nix develop` sets IN_NIX_SHELL, so a nested invocation
# (e.g. already inside the shell) is a no-op past this check.
if [ -z "${IN_NIX_SHELL:-}" ]; then
exec nix develop "$SRC_DIR" --command "$0" "$@"
fi
# --incremental (bug-1565 escape hatch): opt-in, NOT the default. Every
# invocation normally does a full `rm -rf "$BUILD_DIR"` + fresh `meson
# setup` (see setup_build below) -- correct in isolation, but since
@ -72,9 +87,6 @@ case "$PROFILE" in
release) MESON_OPTS=(--buildtype=release -Db_sanitize=none); RUN_TESTS=0 ;;
esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SRC_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$SRC_DIR"
# build-time-versioning task 2.1: compute commit_id/build_time once, common to