Repository navigation
3C-B0: reproducible Nix dev shell for the local wasm build + Playwright - #143
Conversation
…ght web-test (3C-B0)
A repo-root flake so `nix develop` gives an environment where the existing
commands run unchanged and cockpit-web-test is a local check, not a cloud-only
oracle:
nix develop
./cockpit/build-web.sh
cd cockpit/web-test && npm ci && npm test
The flake provides, without duplicating any repo-pinned version:
- Rust via rustup (toolchain from rust-toolchain.toml);
- wasm-bindgen-cli installed at exactly cockpit/Cargo.toml's version (build-web.sh
still enforces the match);
- Node 22 and a Playwright Chromium — nixpkgs pinned to nixos-25.11, whose
playwright-driver is 1.56.1, the exact version in web-test/package.json, so the
Nix browser revision matches the npm Playwright;
- a target-scoped wasm C toolchain: an unwrapped clang driven only for
wasm32-unknown-unknown (CC_wasm32_unknown_unknown / AR_ / CFLAGS_), which fixes
the zstd-to-x86 miscompile that left ZSTD_* undefined at the wasm link. Being
target-scoped, native cargo in the same shell keeps host gcc with no wasm flags.
Proven end to end on NixOS/WSL: build-web.sh links a full 5.4 MiB wasm bundle and
`npm test` runs the real cockpit in Chromium (15/16 pass, 0 fail). CI stays on its
own working setup — this is a local-dev convenience, not a CI rewrite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
|
Warning Review limit reached
Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6de1b9fac3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| outputs = | ||
| { self, nixpkgs }: | ||
| let | ||
| system = "x86_64-linux"; |
There was a problem hiding this comment.
Generate dev shells for supported host systems
When a contributor's Nix system is anything other than x86_64-linux (for example aarch64-linux or Darwin), nix develop will look for devShells.<system>.default (as documented by the Nix manual), but this flake only emits devShells.x86_64-linux.default. That makes the documented local web-test shell unavailable on those hosts even though the toolchain is otherwise not inherently x86-only; please generate shells for the supported systems or document the shell as Linux x86_64-only.
Useful? React with 👍 / 👎.
What
A repo-root
flake.nix(+flake.lock) so the cockpit-web-test — wasm build +real cockpit in headless Chromium — runs locally, reproducibly, instead of
being a cloud-only oracle. This is 3C-B0, the substrate slice before the
3C-B curation flow.
The flake gives an environment for the existing scripts; it adds no fourth
build script and duplicates no repo-pinned version.
The fix that makes it work
The wasm build failed to link because the Guitar Pro reader's
zstdC subtreewas compiled to x86 objects (
undefined symbol: ZSTD_*at the wasm link):Nix's standard cc-wrapper forces the host target. The flake drives an
unwrapped clang, scoped to the wasm target only:
Because these are
*_wasm32_unknown_unknown, a nativecargo test/clippyinthe same shell uses host
gccwith no wasm flags — the host build isuntouched.
Versions stay repo-defined
rustup+ the repo'srust-toolchain.toml.wasm-bindgen-cli: a shell hook installs exactlycockpit/Cargo.toml'spinned version (read from there);
build-web.shstill enforces the match.nixpkgspinned tonixos-25.11, whoseplaywright-driveris 1.56.1 — the exact version inweb-test/package.json— so the Nix browser revision matches the npmPlaywright. One input covers the toolchain and the browser.
Acceptance (all 7)
nix developenters without manualnix-shell -p …build-web.shfully links wasm (not just to lld)dist/npm ci && npm testlaunches Chromium locallycargo test/clippyin-shell get no wasm CC/CFLAGSCC=gcc,CFLAGS=emptyProven on NixOS/WSL,
nixpkgslocked atb6018f87.Not included
No cockpit code — that's 3C-B1 (
CurationSession+ event minting) onward. Thepre-existing
Cargo.lockdrift onmain(3C-A's cockpit→thiserroredge neverlanded in the lock; CI doesn't build
--locked) is flagged separately, notbundled here.
🤖 Generated with Claude Code