Commit graph

18 commits

Author SHA1 Message Date
605844f5be nix: disable accept-flake-config to avoid ca-derivations schema crash
The previous ca-derivations attempt didn't actually fix the schema
issue — Nix 2.34.7's v10 → v11 migration (which adds the
Realisations table) doesn't fire cleanly even with the feature
pre-enabled at install time. First nix develop against a flake
that requests ca-derivations crashes with
`Assertion 'stmt.stmt' failed in nix::SQLiteStmt::Use::Use`.

Workaround: set accept-flake-config=false. Flake nixConfig blocks
trying to add ca-derivations to our experimental-features get
ignored. Realisation queries never fire. Builds use the default
input-addressed path and work fine.

Substituters are now in our base nix.conf (cache.nixos.org +
cache.iog.io) so we don't lose the IOG binary cache by ignoring
the flake's substituter additions. mlabs.cachix.org dropped —
it's a private cache returning 401 to anonymous reads.

Verified live: nix develop against github:Liqwid-Labs/agora
proceeds past the previous crash point, pulling haskell-nix
closure from cache.iog.io.
2026-05-06 21:24:35 -07:00
740b92c7f4 nix: enable ca-derivations + IOG/MLabs caches at install time
Two coupled fixes in section 19.5 of the Dockerfile:

1. Add ca-derivations to experimental-features. Without it, the
   SQLite store is initialized at schema v10 (no Realisations
   table). Plutarch / Liqwid Agora / IOG flakes request
   ca-derivations via nixConfig; first realisation query then
   crashes with `Assertion 'stmt.stmt' failed in nix::SQLiteStmt::
   Use::Use(SQLiteStmt&)`. Pre-enabling at install time means
   store init creates schema v11 with the table. Self-inflicted
   wound caught in the first nix develop attempt against
   github:Liqwid-Labs/agora.

2. Add cache.iog.io + mlabs.cachix.org as substituters with their
   public keys. Without these, every Cardano/Plutarch dep gets
   built from source — hours of GHC compile vs minutes of binary
   cache pull.

Also: write nix.conf BEFORE running the Nix install script,
because the installer reads the user's nix.conf during init to
decide schema. Order-dependent.

accept-flake-config = true so flake nixConfig blocks (which add
their own substituters / experimental features) work without
re-prompting per command.
2026-05-06 21:20:36 -07:00
1ef50307ac fix go-install verification in Dockerfile
Latent bug: the post-loop check used `command -v` to verify
govulncheck and staticcheck installed. `command -v` only walks
PATH, but at this layer PATH does NOT include $GOPATH/bin
(/home/crafter/go/bin) — that's only added in the canonical
final PATH at the bottom of the Dockerfile (line 314). At
runtime the binaries work fine via the bottom PATH; only the
build-time verify was broken.

The bug was masked by stale Docker layer caching from earlier
Dockerfile shapes. Adding the new Nix layer above this step
invalidated the cache and surfaced it.

Switch to direct binary path checks (test -x \"\$GOPATH/bin/...\")
which work regardless of PATH state at the layer.
2026-05-06 17:05:37 -07:00
b0490a8c02 add Nix toolchain + bump Go to 1.25.9
Two coupled changes:

1. Add a single-user Nix install at section 19.5 so the container can
   `nix develop` / `nix run` / `nix build` for the Cardano smart-
   contract toolchain stack (Plutarch, plutus-core, Liqwid Agora's
   `agora-scripts` exporter — all ship as IOG haskell-nix flakes
   with pinned GHC). Without Nix, building any of those is a manual-
   version-pinning fight.

   Single-user mode (no daemon), sandbox=false (containers can't nest
   sandboxes cleanly), flakes + nix-command experimental features
   enabled. /nix is owned by `crafter` and bind-mounted from
   /mnt/user/appdata/crafting-table/nix in compose so the multi-GB
   haskell-nix downloads survive container rebuilds.

2. Bump GO_VERSION 1.22.10 → 1.25.9. govulncheck@latest (v1.3.0) and
   staticcheck@latest (v0.7.0) both now require Go ≥ 1.25 — building
   with 1.22 hits "requires go >= 1.25.0" and the per-step retry loop
   exhausts. Go's auto-toolchain-switch tries to download 1.25.9 on
   the fly but staticcheck's parent build then runs in 1.22 and
   re-fails. Pinning to 1.25.9 (current Go release) sidesteps the
   wedge.

PATH bump: prepend /home/crafter/.nix-profile/bin so nix-installed
binaries (cabal, ghc inside dev shells, cardano-cli, etc) take
precedence over system tooling without per-recipe prefixing.

Build invocation unchanged — nothing required at the docker run /
docker compose layer beyond the new /nix bind mount in compose.yml.
2026-05-06 15:08:01 -07:00
d3babae46d Dockerfile: remove dead PATH-clobber from GOPATH-fix; final clean PATH at end is single source of truth 2026-04-29 16:07:40 -07:00
80c4eebf3b Dockerfile: --force-reinstall on app pip install (otherwise click stays in /root/.local from pipx bootstrap and uvicorn can't see it) 2026-04-29 15:21:11 -07:00
327b072545 Dockerfile: use python3 -m pipx (PATH-free invocation) for pipx layer 2026-04-29 14:43:30 -07:00
569691a555 Dockerfile: skip cargo-audit/cargo-deny install (both flaking); keep mypy types-requests fix 2026-04-29 14:42:40 -07:00
44535acdf8 Dockerfile: cargo-deny via prebuilt github release binary (cargo install too flaky) 2026-04-29 14:41:48 -07:00
64415348ce Dockerfile: drop cargo-audit (libgit2-sys broken); cargo-deny supersedes 2026-04-29 14:40:27 -07:00
e268986f87 Dockerfile: cargo-audit/cargo-deny to /usr/local + mypy type stubs
Two recipe-shape gaps caught by the all-SDK lint+audit dogfood:

1. `cargo install --root /caches/cargo cargo-audit cargo-deny` lost its
   binaries at runtime because /caches/cargo is volume-shadowed by the
   host bind mount. Fix: install with `--root /usr/local` so the bins
   land in /usr/local/bin (root-owned, not volume-shadowed). Required
   USER root briefly to write to /usr/local; reverts to crafter after.

2. `mypy --strict` against any project that imports requests/PyYAML/
   setuptools fails with "Library stubs not installed" exit 1 because
   pipx-installed mypy lives in its own venv and doesn't see the
   stubs. Fix: `pipx inject mypy types-requests types-PyYAML
   types-setuptools` so the stubs land in mypy's venv.
2026-04-29 14:20:53 -07:00
510915d3ec Dockerfile: clean final PATH at end (single source of truth)
The agent-generated Dockerfile accumulated PATH via 6+ layered ENV
PATH= statements, and my own GOPATH-fix edit (commit 6cd5990) wrote
a literal-expanded PATH that clobbered the swift/kotlin/gradle/bun/
cargo entries. Result: cargo unreachable from crafter user (caught
by the 14-SDK queue dogfood — exit 127 'Permission denied' on cargo
build).

Fix: a final ENV PATH= line right before the CMD that sets PATH to
a clean, comprehensive list of every toolchain bin. Overrides any
drift above. Includes:
- /home/crafter/.local/bin (pipx tools: ruff, mypy, pytest, pip-audit, uv, semgrep)
- /home/crafter/.composer/vendor/bin (phpstan, phpunit)
- /home/crafter/.local/share/gem/ruby/3.1.0/bin (bundler-audit, rubocop)
- /home/crafter/.bun/bin (bun)
- /home/crafter/go/bin (govulncheck, staticcheck)
- /home/crafter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin (cargo, rustc, clippy, rustfmt)
- /caches/cargo/bin (cargo install artifacts; volume-mounted)
- /opt/swift/usr/bin (swift)
- /opt/kotlin/bin (kotlinc)
- /opt/gradle/bin (gradle)
- /usr/local/go/bin (go)
- system bins

Once this rebuild lands, the rust recipes can drop the per-recipe
PATH= prefix the workaround used.
2026-04-29 14:09:32 -07:00
a1b3c72c8f Dockerfile: retry go install up to 5x with backoff — DNS to 192.168.0.1:53 flakes intermittently for proxy.golang.org 2026-04-29 18:41:59 +00:00
6cd599079b Dockerfile: set GOPATH=/home/crafter/go BEFORE go install layer (was inheriting /root/go) 2026-04-29 18:06:02 +00:00
6c8b0528ab Dockerfile: pin shfmt URL to /releases/download/v3.10.0/ — /latest/download/ broke when shfmt latest moved past v3.10.0 2026-04-29 17:26:48 +00:00
101c8ec2e7 Dockerfile: SHELL [/bin/bash] before Swift layer — fixes ${var//pattern} bash-ism that dash chokes on 2026-04-29 17:16:43 +00:00
2e16ec886d wave 1 wiring: Dockerfile API stage + compose API command + README quickstart
- Dockerfile: pip-install requirements.txt and copy crafting_table/ into
  /app, switch CMD from /bin/bash to uvicorn server (port 8810). pip lands
  in /usr/local/bin so the crafter user runs uvicorn without elevation.
- compose.yml: replace smoke.sh entrypoint with the API server command;
  bind 192.168.0.5:8810:8810 (LAN-only); switch named volumes to real
  Lucy appdata paths so /data + /workspace + /caches survive recreate.
  env_file marked optional so a fresh checkout boots without copying
  .env.example.
- README.md: tick steps 1-4 done, document API surface table, add
  curl-based quickstart (mint token → register project → kick off job →
  poll → stream log), and an architecture-notes section covering the
  recipe-immutability snapshot, process-group SIGTERM/SIGKILL escalation,
  WAL+single-writer trade-off, and the recipe-security stance.

Smoke remains runnable on demand:
  docker compose run --rm crafting-table /usr/local/bin/smoke.sh
2026-04-29 08:28:51 -07:00
4e668a79e1 v0.1 step 1: Dockerfile + per-language toolchain smoke
Monolith image with every toolchain in the spec:
- Python 3.12 + uv/ruff/mypy/pytest/pip-audit/semgrep
- Node 22 LTS + bun
- Go 1.22 + govulncheck/staticcheck
- Rust stable + cargo-audit/cargo-deny
- Ruby 3.x + bundler-audit
- PHP 8.x + composer/phpstan
- JDK 17 + 21 + Maven + Gradle
- .NET 8 SDK
- Swift 5.9.2
- Kotlin 1.9.25
- clang + cmake + valgrind + ASan/UBSan/TSan
- bash + shellcheck

smoke.sh proves each toolchain compiles + runs a hello-world.
compose.yml uses the existing 'sulkta' bridge network.

No API yet (steps 2-3); no MCP yet (step 7); no runner yet (step 4).
This is the foundation.

NOTE: docker build + smoke verification not yet run — sandbox doesn't
have docker. Needs `docker compose build && docker compose up` on Lucy
or any real Docker host before we trust the Dockerfile.

Spec: memory/spec-crafting-table.md
2026-04-29 07:29:53 -07:00