infra: Nix flake dev shell (Rust, Bun, Node, Playwright) #779

Closed
kayg wants to merge 0 commits from infra/nix-devshell into dev
Owner

What

flake.nix + flake.lock: devShells.default for x86_64-linux, aarch64-linux, aarch64-darwin. Everything comes from Nix.

  • Rust 1.99.0 with clippy and rustfmt, via oxalica/rust-overlay fromRustupToolchainFile ./rust-toolchain.toml
  • Bun 1.4.2 (matches ci/web.Dockerfile), Node 24, pkg-config, OpenSSL, SQLite, ripgrep, fontconfig; clang+mold on Linux
  • Playwright browsers from nixpkgs playwright-driver.browsers (PLAYWRIGHT_BROWSERS_PATH, PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true): chromium, chromium_headless_shell, firefox, webkit, ffmpeg
  • CI uses bun (bun install --frozen-lockfile) and cargo; no other package manager.
  • README: new "Dev shell: nix develop" section.

Decisions

  • Playwright version: repo pins @playwright/test 1.63.0; nixpkgs unstable now has 1.64.1. Not changing the repo. nixpkgs is pinned to 1e7da2489c0b (parent of "playwright: 1.63.0 -> 1.64.1"), which still ships 1.63.0 (browsers chromium-1243, webkit-2359). The shellHook warns if apps/web/package.json and the pinned driver diverge. Bump the pin when Playwright is bumped.
  • WebKit on non-NixOS Linux aborted with "Could not create EGL display" (found on dev-02). The shell sets __EGL_VENDOR_LIBRARY_FILENAMES to Mesa's glvnd vendor file and LIBGL_ALWAYS_SOFTWARE=1 on Linux; fixed.
  • FONTCONFIG_FILE is set to Nix's fontconfig (apps/web/playwright.config.ts already expects this on Nix hosts).

Enter the shell

Any machine: cd <worktree> && nix develop or one-shot nix develop -c bash -lc '...'.

  • Linux (dev-01 / dev-02): export PATH=/nix/var/nix/profiles/default/bin:$PATH if nix is not on PATH.
  • macOS: . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh first.

Verification (all inside nix develop, worktree ~/Developer/Worktrees/nix-devshell, commit c61c91d3)

which cargo node bun resolved to /nix/store paths on every machine. cargo 1.99.0, node v24.21.0, bun 1.4.2.

machine cargo build --workspace bun install --frozen-lockfile + bun run --cwd apps/web build Playwright e2e/empty.spec.ts, 1 worker
dev-01 x86_64 Debian (-j8) pass (1m27s) pass chromium-1440 2/2, webkit-1440 2/2
dev-02 aarch64 Linux (-j6) pass pass chromium-1440 2/2, webkit-1440 2/2 (after the EGL fix)
macOS arm64 (-j3) pass (1m52s) pass chromium-1440 2/2, webkit-1440 2/2

Playwright ran against the locally built target/debug/calternal (CALTERNAL_BIN). The old /usr/local toolchains on dev-02 and the Mac were left alone and not used.

Could not be done / caveats

  • Nothing was installed outside Nix. On macOS the nixpkgs browsers (chromium and webkit) worked for the spec I ran; full-suite behaviour there was not exercised.
  • cargo clippy/cargo test --workspace were not run (the requested verification was build only); the toolchain provides them.
  • First nix develop on dev-02 hit a transient "Truncated tar archive" while fetching nixpkgs; a retry succeeded.
## What `flake.nix` + `flake.lock`: `devShells.default` for x86_64-linux, aarch64-linux, aarch64-darwin. Everything comes from Nix. - Rust 1.99.0 with clippy and rustfmt, via oxalica/rust-overlay `fromRustupToolchainFile ./rust-toolchain.toml` - Bun 1.4.2 (matches `ci/web.Dockerfile`), Node 24, pkg-config, OpenSSL, SQLite, ripgrep, fontconfig; clang+mold on Linux - Playwright browsers from nixpkgs `playwright-driver.browsers` (`PLAYWRIGHT_BROWSERS_PATH`, `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true`): chromium, chromium_headless_shell, firefox, webkit, ffmpeg - CI uses bun (`bun install --frozen-lockfile`) and cargo; no other package manager. - README: new "Dev shell: `nix develop`" section. ## Decisions - **Playwright version**: repo pins `@playwright/test` 1.63.0; nixpkgs unstable now has 1.64.1. Not changing the repo. `nixpkgs` is pinned to `1e7da2489c0b` (parent of "playwright: 1.63.0 -> 1.64.1"), which still ships 1.63.0 (browsers chromium-1243, webkit-2359). The shellHook warns if `apps/web/package.json` and the pinned driver diverge. Bump the pin when Playwright is bumped. - WebKit on non-NixOS Linux aborted with "Could not create EGL display" (found on dev-02). The shell sets `__EGL_VENDOR_LIBRARY_FILENAMES` to Mesa's glvnd vendor file and `LIBGL_ALWAYS_SOFTWARE=1` on Linux; fixed. - `FONTCONFIG_FILE` is set to Nix's fontconfig (apps/web/playwright.config.ts already expects this on Nix hosts). ## Enter the shell Any machine: `cd <worktree> && nix develop` or one-shot `nix develop -c bash -lc '...'`. - Linux (dev-01 / dev-02): `export PATH=/nix/var/nix/profiles/default/bin:$PATH` if nix is not on PATH. - macOS: `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh` first. ## Verification (all inside `nix develop`, worktree `~/Developer/Worktrees/nix-devshell`, commit c61c91d3) `which cargo node bun` resolved to /nix/store paths on every machine. cargo 1.99.0, node v24.21.0, bun 1.4.2. | machine | cargo build --workspace | bun install --frozen-lockfile + `bun run --cwd apps/web build` | Playwright `e2e/empty.spec.ts`, 1 worker | |---|---|---|---| | dev-01 x86_64 Debian (-j8) | pass (1m27s) | pass | chromium-1440 2/2, webkit-1440 2/2 | | dev-02 aarch64 Linux (-j6) | pass | pass | chromium-1440 2/2, webkit-1440 2/2 (after the EGL fix) | | macOS arm64 (-j3) | pass (1m52s) | pass | chromium-1440 2/2, webkit-1440 2/2 | Playwright ran against the locally built `target/debug/calternal` (`CALTERNAL_BIN`). The old /usr/local toolchains on dev-02 and the Mac were left alone and not used. ## Could not be done / caveats - Nothing was installed outside Nix. On macOS the nixpkgs browsers (chromium and webkit) worked for the spec I ran; full-suite behaviour there was not exercised. - `cargo clippy`/`cargo test --workspace` were not run (the requested verification was build only); the toolchain provides them. - First `nix develop` on dev-02 hit a transient "Truncated tar archive" while fetching nixpkgs; a retry succeeded.
flake: Mesa EGL for WebKit on Linux
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
c61c91d39f
Author
Owner

BM8 validation at scratch b9dac07806a398f53f8a9acaf1506d4b6f718a30: cargo fmt --all -- --check and cargo test --workspace -j4 passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: #844 (comment). No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.

BM8 validation at scratch `b9dac07806a398f53f8a9acaf1506d4b6f718a30`: `cargo fmt --all -- --check` and `cargo test --workspace -j4` passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: https://git.kayg.org/kayg/calternal/pulls/844#issuecomment-74911. No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.
Author
Owner

Closing: head 7b97e4d1 is already in dev (reached via fdff1ec2); nothing left to merge. Branch kept.

Closing: head 7b97e4d1 is already in dev (reached via fdff1ec2); nothing left to merge. Branch kept.
kayg closed this pull request 2026-11-04 13:04:39 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!779
No description provided.