From 1257754c68bf8eb53cc33035cb79c66042cf6bbc Mon Sep 17 00:00:00 2001 From: Jakob Stender Guldberg Date: Mon, 21 Sep 2026 15:18:43 +0200 Subject: [PATCH] build(nix): turn off incremental so sccache actually caches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- flake.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flake.nix b/flake.nix index ea9be1f..003c7ab 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,17 @@ ]; RUSTC_WRAPPER = "sccache"; + # sccache refuses to cache any rustc call carrying -C incremental, + # which cargo passes for every dev/test build — so the wrapper above + # is dead weight unless incremental is off. Across the worktrees this + # repo is developed in, sharing 760+ compiled dependency crates beats + # incremental relinking inside a single one. + CARGO_INCREMENTAL = "0"; + + # Default is 10G, which one worktree's dependency graph nearly fills; + # several branches in flight evict each other faster than they hit. + SCCACHE_CACHE_SIZE = "50G"; + # Playwright browsers come from nixpkgs, never from npm's downloader: # the downloaded builds are not patched for NixOS and die on launch. # `@playwright/test` in crates/diffcore-tauri/ui/package.json is pinned