3.8 KiB
3.8 KiB
Todo
Sccache Stdenv Direction
- Goal: move
sccacheto the same structural layer asccacheStdenv, meaning between the Nix cc-wrapper and the real compiler, instead of wrapping the cc-wrapper script itself. - Reason: this should preserve normal compiler identity and wrapper semantics while still allowing cached compilations.
- Constraint: prefer direct local-disk cache access for sandboxed builds and avoid depending on the external
sccacheclient/server socket model.
Current Implementation State
- Added a local patch to
sccacheso its GCC/Clang parser treats-cxx-isystem <dir>like-isystem <dir>. - Added
sccache.links, modeled after nixpkgsccache.links, to generatecc/c++/gcc/g++/clang/clang++wrappers that callsccachewith the real compiler path. - Added
sccacheWrapper, modeled after nixpkgsccacheWrapper. - Added
sccacheStdenv, modeled after nixpkgsccacheStdenv. - Reworked
mkSccacheStdenvto delegate tosccacheWrapperinstead of patching cc-wrapper scripts directly. - Kept direct-disk cache configuration through generated
SCCACHE_CONFandSCCACHE_NO_DAEMON=1. - Adjusted the wrapper override helper so it can handle both normal cc-wrappers (
cc = ...) and Intel SYCL wrappers (llvm = ...). - Forwarded Intel-expected outputs/attrs like
.dev,.lib, and.rsrcthroughsccache.links.
Verified Findings
- The previous direct insertion into cc-wrapper final exec did not break hello-world compilation.
- That previous attempt was not cache-effective because
sccacheinterpreted wrapper-emitted-cxx-isystemarguments as extra input files and returnedmultiple input files. - The exact problematic arguments were confirmed with a direct
sccache clang ...probe using the wrapper-emitted argv. - The new ccache-style
sccacheWrapper/sccacheStdenvpath evaluates successfully. intel-sycl.stdenv.ccnow also evaluates successfully with the ccache-stylesccache.linksreplacement in place.- The custom kernel helper now normalizes config-only
kernelPatchesentries to{ patch = null; ... }before callingbuildLinux, which fixesdevenv shell -- buildfailing during kernel evaluation. - The kernel build does invoke
sccacheduring live builds, but relying on the in-sandbox wrapper to create/var/cache/sccache/nix-builds/kernelmade host-side observation ambiguous. - The host NixOS config should create and expose
/var/cache/sccache/nix-builds/{packages,kernel}explicitly so sandboxed builds and host-side inspection see the same cache paths.
Next Checks
electron-real-clang-baseshould stay store-pure: synthesize its output tree from symlinks only and nevercp/rmagainst copied toolchain store content.mkCmakeSccacheAttrsshould not force raw compilers into CMake; thesccache.linkswrappers should bypass CMake probe invocations while keeping the normal wrapper-selected compiler environment.- The probe bypass must inspect
@responseFilearguments as well, because the cc-wrapper often hidesCMakeFiles/CompilerIdpaths inside response files before the innerwrapped-sccachesees them. - For CMake packages, the practical fallback is to export
SCCACHE_WRAPPED_COMPILER_PASSTHROUGH=1for the wholeconfigurePhaseand unset it inpostConfigure; caching matters inbuildPhase, not in compiler-ID probes. - Apply the shared CMake helper to stalled subpackages too, not just top-level wrappers.
oneapi-math-sycl-blasis one such case. - The same helper may also be needed on the outer package if the subpackage is fixed but the wrapper package then stalls at its own CMake configure.
- Run a minimal hello-world derivation with the new
sccacheStdenvand confirm repeated compiles produce cache hits. - If that works, switch current consumers to the ccache-style path and remove obsolete wrapper-patching logic.