feat(container): first-boot apt provisioning for agent tools

Installs nodejs, npm, curl via apt and uv via curl on first container
boot. Uses sentinel file so subsequent boots skip. Container recreation
triggers fresh install. Combined with --suffix PATH change, agents get
mutable tools that support npm i -g and uv without hitting read-only
nix store paths.
This commit is contained in:
Hermes Agent 2026-03-26 21:55:38 +00:00
parent 5f797c098f
commit 991ca41586

View file

@ -121,6 +121,21 @@
chmod 0440 /etc/sudoers.d/hermes
fi
# ── Provision mutable agent tools (first boot only, cached in writable layer) ──
# Agents need extensible tools (nodejs/npm for npm i -g, uv for Python).
# These live in /usr/bin and ~/.local/bin so they're writable, unlike nix store.
# The hermes wrapper uses --suffix PATH so these take priority over nix fallbacks.
if [ ! -f /var/lib/hermes-tools-provisioned ] && command -v apt-get >/dev/null 2>&1; then
echo "First boot: provisioning agent tools..."
apt-get update -qq
apt-get install -y -qq nodejs npm curl
# uv (Python manager) — not in Ubuntu repos, installed as target user
if ! command -v uv >/dev/null 2>&1; then
su -s /bin/sh "$TARGET_USER" -c 'curl -LsSf https://astral.sh/uv/install.sh | sh' || true
fi
touch /var/lib/hermes-tools-provisioned
fi
if command -v setpriv >/dev/null 2>&1; then
exec setpriv --reuid="$HERMES_UID" --regid="$HERMES_GID" --init-groups "$@"
elif command -v su >/dev/null 2>&1; then