build(nix): turn off incremental so sccache actually caches - #20
Merged
jamesaphoenix merged 1 commit intoSep 21, 2026
Merged
Conversation
RUSTC_WRAPPER=sccache has been a no-op for every dev build: cargo passes -C incremental for the dev and test profiles, and sccache classifies any rustc call carrying that flag as non-cacheable. Verified against the devshell's own toolchain — identical invocations cache and hit without the flag, and report "non-cacheable call" with it. With seven worktrees in flight the cross-worktree reuse of 760+ compiled dependency crates is worth more than incremental relinking inside one of them, and dropping incremental also reclaims the multi-GB target/debug/incremental tree each worktree was carrying. Raise the cache ceiling while here: the 10G default is nearly filled by a single worktree's dependency graph, so concurrent branches were evicting each other's entries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RUSTC_WRAPPER = "sccache"in the devshell has never cached a dev build. Cargo passes-C incremental=<dir>for the dev and test profiles, and sccache treats any rustc invocation carrying that flag as non-cacheable.Verified against the devshell's own toolchain (rustc 1.94.0, sccache 0.17.0), same rustc args in all three calls:
The evidence in a working checkout is the
target/debug/incrementaltree — multiple GB per worktree, which only exists because incremental is on, which is exactly why nothing was reaching the cache.Change
CARGO_INCREMENTAL = "0"— makes the existing wrapper live.SCCACHE_CACHE_SIZE = "50G"— the 10G default is nearly filled by one worktree's dependency graph, so branches in flight were evicting each other.Trade-off
Incremental wins on repeated rebuilds inside one checkout after a small edit. sccache wins on first builds across checkouts and branch switches. With 764 dependency crates and several worktrees in flight, the second dominates — and the deleted incremental trees pay back several GB per worktree.
Not benchmarked end to end: the non-cacheable classification is measured, the size of the speedup is not.