# Todo ## Sccache Stdenv Direction - Goal: move `sccache` to the same structural layer as `ccacheStdenv`, 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 `sccache` client/server socket model. ## Current Implementation State - Added a local patch to `sccache` so its GCC/Clang parser treats `-cxx-isystem ` like `-isystem `. - Added `sccache.links`, modeled after nixpkgs `ccache.links`, to generate `cc`/`c++`/`gcc`/`g++`/`clang`/`clang++` wrappers that call `sccache` with the real compiler path. - Added `sccacheWrapper`, modeled after nixpkgs `ccacheWrapper`. - Added `sccacheStdenv`, modeled after nixpkgs `ccacheStdenv`. - Reworked `mkSccacheStdenv` to delegate to `sccacheWrapper` instead of patching cc-wrapper scripts directly. - Kept direct-disk cache configuration through generated `SCCACHE_CONF` and `SCCACHE_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 `.rsrc` through `sccache.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 `sccache` interpreted wrapper-emitted `-cxx-isystem` arguments as extra input files and returned `multiple input files`. - The exact problematic arguments were confirmed with a direct `sccache clang ...` probe using the wrapper-emitted argv. - The new ccache-style `sccacheWrapper` / `sccacheStdenv` path evaluates successfully. - `intel-sycl.stdenv.cc` now also evaluates successfully with the ccache-style `sccache.links` replacement in place. - The custom kernel helper now normalizes config-only `kernelPatches` entries to `{ patch = null; ... }` before calling `buildLinux`, which fixes `devenv shell -- build` failing during kernel evaluation. ## Next Checks - `electron-real-clang-base` should stay store-pure: synthesize its output tree from symlinks only and never `cp`/`rm` against copied toolchain store content. - `mkCmakeSccacheAttrs` should not force raw compilers into CMake; the `sccache.links` wrappers should bypass CMake probe invocations while keeping the normal wrapper-selected compiler environment. - The probe bypass must inspect `@responseFile` arguments as well, because the cc-wrapper often hides `CMakeFiles/CompilerId` paths inside response files before the inner `wrapped-sccache` sees them. - For CMake packages, the practical fallback is to export `SCCACHE_WRAPPED_COMPILER_PASSTHROUGH=1` for the whole `configurePhase` and unset it in `postConfigure`; caching matters in `buildPhase`, not in compiler-ID probes. - Apply the shared CMake helper to stalled subpackages too, not just top-level wrappers. `oneapi-math-sycl-blas` is 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 `sccacheStdenv` and confirm repeated compiles produce cache hits. - If that works, switch current consumers to the ccache-style path and remove obsolete wrapper-patching logic.