Skip to content

Remove cmake-era setup from the Nix shells and CONTRIBUTING.md - #38543

Open
robobun wants to merge 2 commits into
mainfrom
farm/efe4758d/nix-cmake-leftovers
Open

Remove cmake-era setup from the Nix shells and CONTRIBUTING.md#38543
robobun wants to merge 2 commits into
mainfrom
farm/efe4758d/nix-cmake-leftovers

Conversation

@robobun

@robobun robobun commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

  • flake.nix and shell.nix still export CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR, CMAKE_RANLIB and CMAKE_SYSTEM_PROCESSOR from their shellHook, and flake.nix still sets CMAKE_BUILD_TYPE = "Debug" and ENABLE_CCACHE = "1" (flake.nix:142-146, 171-172; shell.nix:84-88).
  • The Nix snippet in CONTRIBUTING.md (line 12-13) tells contributors to export CMAKE_SYSTEM_PROCESSOR=$(uname -m) before bun bd, and offers a nix develop .#pure shell that flake.nix has never defined (it only has devShells.default).
  • CONTRIBUTING.md also still documents bun run build -DUSE_STATIC_LIBATOMIC=OFF (line 366) and refers to make setup / bun setup / cloning submodules (lines 153, 308, 316).
  • All of this dates from the CMake build, which delete cmake #28640 deleted. Nothing in the tree reads these variables any more:
    • git grep -nE 'env(\.|\[)CMAKE_|ENABLE_CCACHE' -- scripts is empty.
    • The compiler, archiver, ranlib and build type reach the one remaining cmake consumer (the nested cmake build for local WebKit) as explicit -D arguments from the resolved toolchain, scripts/build/source.ts:1148-1152 and :1194, so the environment is never consulted for them.
    • The target arch comes from clang's default target (clangTargetArch, scripts/build/tools.ts:192), with no environment override.
    • ccache is used whenever it is found (cfg.ccache, scripts/build/source.ts:1178); ENABLE_CCACHE and the CMAKE_BUILD_TYPE env lookup were features of the deleted optionx cmake macro.
    • -DUSE_STATIC_LIBATOMIC=OFF is not a --flag, so scripts/build.ts parseArgs treats it as the first exec arg: the build runs with static libatomic anyway and the define is handed to the freshly built binary.

Fix

  • Drop the five CMAKE_* exports from both shell hooks and the CMAKE_BUILD_TYPE / ENABLE_CCACHE attributes from flake.nix. CC, CXX, AR, RANLIB, LD, NIX_CFLAGS_LINK, LD_LIBRARY_PATH and pkgs.cmake stay: cc-rs build scripts read the first group when cargo check / bun run watch are run straight from the shell, and scripts/build/configure.ts:50 still requires cmake for the nested dep builds.
  • Port to CONTRIBUTING.md the same factual fixes docs/project/contributing.mdx already received in docs: fact-check sweep across 120 pages #33706: Nix snippet reduced to nix develop + bun bd, libatomic workaround becomes bun run build --static-libatomic=off, troubleshooting text says bun run build, and the build section says dependencies are downloaded rather than cloned as submodules. The two files now agree on every command they document; the remaining differences between them are wording only.
  • Why this is correct: every removed line names a variable or command that no longer has a reader, and every replacement is what the current build system implements (staticLibatomic in scripts/build.ts boolFields, scripts/build/config.ts:902-905).
  • Verified:
    • bun scripts/build.ts --configure-only --static-libatomic=off configures and the generated build.ninja no longer links -l:libatomic.a; the default configure still does.
    • After the change, git grep -n 'CMAKE_SYSTEM_PROCESSOR\|ENABLE_CCACHE\|CMAKE_C_COMPILER\|CMAKE_AR\|CMAKE_RANLIB' -- ':!vendor' hits only scripts/build code that produces these values itself (source.ts -D args, deps/webkit.ts, xmac.mjs), comments, and an old package.json used as fixture data in test/js/bun/util/zstd.test.ts.
    • prettier --check CONTRIBUTING.md passes.
    • No Nix is available where this was prepared, so nix develop itself was not re-run; the nix change only deletes whole lines inside otherwise unchanged shellHook strings and the mkShell attrset.
  • Scope: this is not a fix for the nix shell itself. On main, flake.lock still pins the nixpkgs from Add Nix flake for development environment #23406 (2025-10-07), which predates the pkgs.nodejs_26 that Upgrade reported Node.js version to 26.3.0 #31991 put at flake.nix:35, so nix develop currently fails at evaluation with or without this PR; Fix up the nix shell loading and build issues #37073 (open) updates the lock and makes the build honour CC/CXX/AR/RANLIB/LD. Fix up the nix shell loading and build issues #37073 keeps the lines removed here and edits other regions of both files, so the two apply in either order. This PR only removes lines that have no reader under any outcome of that work.
  • Docs and dev-shell only; there is no test to add.

Background

  • scripts/build/ replaced the CMake build in delete cmake #28640. It resolves the toolchain itself (tools.ts) and writes a build.ninja; the only cmake it still runs is for nested-cmake dependencies (today just a local WebKit build), and it passes every toolchain setting to that cmake on the command line.
  • optionx was a macro in the deleted cmake/Globals.cmake that let any build option (ENABLE_CCACHE, CMAKE_BUILD_TYPE, ...) be supplied through the environment. That is the mechanism the Nix shells were feeding; it no longer exists.
  • CMAKE_<LANG>_COMPILER, CMAKE_AR and CMAKE_SYSTEM_PROCESSOR are cmake cache/internal variables, not environment variables cmake reads (cmake reads CC/CXX from the environment), so exporting them only ever had an effect through project-specific code, of which none remains.
  • mkShell turns unknown attributes such as CMAKE_BUILD_TYPE = "Debug" into environment variables of the dev shell; removing them removes only those variables.

no test proof · iteration 0 · docs-only change; test-proof not applicable

The top-level CMake build was deleted in #28640. The Nix dev shells still
export CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR, CMAKE_RANLIB and
CMAKE_SYSTEM_PROCESSOR, and flake.nix still sets CMAKE_BUILD_TYPE and
ENABLE_CCACHE. Nothing reads any of these now: scripts/build passes the
compiler, archiver and build type to the nested cmake builds as explicit
-D arguments, picks the target arch from clang's default target, and
enables ccache whenever it is found on PATH. CC, CXX, AR, RANLIB and LD
stay, since cargo build scripts (cc-rs) read them when cargo is run
directly from the shell.

CONTRIBUTING.md gets the same factual fixes docs/project/contributing.mdx
received in #33706: the Nix snippet no longer tells contributors to
export CMAKE_SYSTEM_PROCESSOR or mentions a .#pure dev shell that was
never defined, the libatomic workaround uses the build script's
--static-libatomic=off instead of a cmake -D define, and the
troubleshooting text refers to `bun run build` rather than the removed
`make setup` / `bun setup` and submodule clone.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8c6d7a4a-a2f8-4296-9bbc-0af1514ba05f

📥 Commits

Reviewing files that changed from the base of the PR and between eabb96d and 7d2ede3.

📒 Files selected for processing (3)
  • CONTRIBUTING.md
  • flake.nix
  • shell.nix

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

Status: the stale CMAKE_* / ENABLE_CCACHE settings were confirmed unread by grepping scripts/build (the compiler, archiver, build type and arch all reach the remaining nested cmake build as explicit -D values computed by scripts/build), and the one replaced command, bun run build --static-libatomic=off, was checked with bun scripts/build.ts --configure-only --static-libatomic=off (the generated build.ninja drops -l:libatomic.a).

Nix was not available to re-enter the shells; the nix hunks are whole-line deletions inside otherwise unchanged strings and attrsets. Note that nix develop on main currently fails to evaluate for an unrelated reason (flake.lock predates the nodejs_26 reference added in #31991); #37073 is the open PR for that, and this change neither depends on nor conflicts with it. Details in the PR description.

CI: the diff touches only CONTRIBUTING.md, flake.nix and shell.nix, so no job exercises it. No job has failed on either build: build 96140 passed 177/179 jobs and the remaining two darwin 14 aarch64 test shards expired in the agent queue; the retriggered build 96547 passed everything that reached an agent (45 jobs) and the rest expired in the queue during fleet-wide congestion (main builds in the same window show the same). The only test annotations on both builds are batch failures that passed alone or on retry. Ready for review as is; I am not going to keep retriggering.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — docs and dev-shell cleanup only, no runtime code touched.

What was reviewed:

  • Confirmed --static-libatomic is a real boolFields entry in scripts/build.ts and wired through scripts/build/config.ts:905, so the new CONTRIBUTING.md command is correct.
  • Confirmed nested-cmake in scripts/build/source.ts passes CMAKE_C_COMPILER/CMAKE_AR/CMAKE_BUILD_TYPE etc. as explicit -D args from the resolved toolchain, so the removed shell exports have no remaining reader.
  • Grepped for the removed variable names outside vendor/; the only hits are the build scripts producing them as -D args, a fixture, and unrelated CMAKE_*_COMPILER_LAUNCHER handling in env_loader.rs.
  • flake.nix never defined devShells.pure, so dropping the .#pure reference from CONTRIBUTING.md is a straight doc fix.
Extended reasoning...

Overview

This PR removes CMake-era environment setup that became dead when #28640 replaced the CMake build with scripts/build/. It touches three files: flake.nix and shell.nix (drops five CMAKE_* exports from shellHook plus the CMAKE_BUILD_TYPE/ENABLE_CCACHE mkShell attrs) and CONTRIBUTING.md (drops the nix develop .#pure / CMAKE_SYSTEM_PROCESSOR snippet, replaces make setup/bun setup with bun run build, replaces -DUSE_STATIC_LIBATOMIC=OFF with --static-libatomic=off, and rewords "clone submodules" to "downloads dependencies"). Every line removed is either a shell env export with no reader or a documented command that the current build system does not accept.

Security risks

None. No source, build script, or CI configuration is modified. The Nix changes only remove environment variables from a developer shell; CC/CXX/AR/RANLIB/LD/LD_LIBRARY_PATH are untouched. The CONTRIBUTING.md changes are prose and command examples.

Level of scrutiny

Low. This is a docs + local-dev-shell hygiene change with no effect on the shipped binary or CI. The correctness question is purely "does anything still read these variables?" — I verified that scripts/build/source.ts:1148-1194 forwards the compiler, archiver, ranlib, and build type to nested cmake as explicit -D arguments derived from the resolved cfg toolchain (not from env), that scripts/build.ts declares staticLibatomic in its bool flags, and that a repo-wide grep for the removed names (excluding vendor/) finds only producers and unrelated *_LAUNCHER handling. flake.nix at HEAD defines only devShells.default, so the removed .#pure reference was already broken.

Other factors

No CODEOWNERS entries cover CONTRIBUTING.md, flake.nix, or shell.nix. There are no prior human review comments to address, and the bug-hunting pass found nothing. The PR description's own verification (git grep for remaining readers, --configure-only --static-libatomic=off producing a build.ninja without -l:libatomic.a) matches what I checked. The author notes nix develop itself was not re-run for lack of Nix, but the edits are pure deletions of exports/attrs inside otherwise-unchanged string literals and attrsets — there is no Nix-syntax risk here.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — docs and dev-shell cleanup removing stale CMake-era env exports and commands.

What was reviewed:

  • Confirmed scripts/build/ never reads the removed CMAKE_* / ENABLE_CCACHE env vars — all remaining hits are code that produces them as explicit -D args to nested cmake, comments, or fixture data.
  • Verified --static-libatomic=off is the real flag (staticLibatomic in scripts/build.ts boolFields, scripts/build/config.ts:905).
  • CONTRIBUTING.md now matches docs/project/contributing.mdx on the Nix snippet and libatomic command; flake.nix never defined a .#pure shell.
  • Nix changes are pure line deletions inside otherwise-unchanged shellHook strings and the mkShell attrset — no syntax risk.
Extended reasoning...

Overview

This PR touches three files: CONTRIBUTING.md, flake.nix, and shell.nix. It removes environment-variable exports (CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR, CMAKE_RANLIB, CMAKE_SYSTEM_PROCESSOR) and mkShell attributes (CMAKE_BUILD_TYPE, ENABLE_CCACHE) that were only consumed by the deleted CMake build system, and updates CONTRIBUTING.md to drop references to nix develop .#pure (never existed), make setup/bun setup, submodule cloning, and -DUSE_STATIC_LIBATOMIC=OFF — replacing them with the current bun run build / --static-libatomic=off equivalents that docs/project/contributing.mdx already documents.

Security risks

None. No runtime, build-script, or native code is touched. The changes are contributor documentation and Nix dev-shell environment variables, which affect only the local shell of a developer who opts into nix develop.

Level of scrutiny

Low. This is a docs + dev-environment cleanup with no shipped code impact. I verified the factual claims: grepping the tree (excluding vendor/) for the removed variable names shows only scripts/build/source.ts and deps/webkit.ts writing them as explicit -D cmake args from the resolved toolchain, comments in tools.ts/config.ts/flags.ts, the cross-compile toolchain file generator xmac.mjs, an unrelated env_loader.rs ccache-launcher path (different variables), and fixture data in zstd.test.ts. Nothing reads them from the process environment. The --static-libatomic=off replacement is the real flag name per scripts/build.ts:443 and scripts/build/config.ts:903-905. docs/project/contributing.mdx:15,19,370 already carries the identical wording, so this brings the two contributor docs into agreement.

Other factors

The Nix edits are pure whole-line deletions inside multi-line ''...'' shellHook strings and a two-attribute deletion from the mkShell attrset — the surrounding string concatenation and Nix syntax are unchanged, so there is no evaluation risk even though nix develop was not re-run. No CODEOWNERS entries cover these files. No prior human review comments to address. Per the repo's own "Docs, types, and comments" guidance, docs-only changes with no test to add are expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant