CI: speed up nix-shell cargo test/clippy (persist target cache + pin flake + sccache opt-in) #2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CI
cargo test --lib+cargo clippysteps take ~8 min vianix shell github:NixOS/nixpkgs/nixos-25.11#rustc #cargo #clippy #gcc. This is the single biggest iteration friction (local incremental builds are ~18s).Three levers:
github:NixOS/nixpkgs/nixos-25.11fetches nixpkgs from github on every run (network + eval). Pin to the runner's local channel or commit-checkout a flake.lock so nixpkgs is already in the store.CARGO_TARGET_DIRunder the persistent runner cache (e.g./var/lib/forgejo-runner/.cache/<slug>-target) so incremental builds reuse compiled deps.RUSTC_WRAPPER=sccache+SCCACHE_DIR(depends on sccache installed on the runner — platform prerequisite, separate ticket). Caches compilation artifacts across runs.Observed: run 60's CI compiled tokio from scratch despite deps being unchanged from the prior run — target cache is not being reused.
Superseded by #11 (migrate to dynamic-nix). dynamic-nix has no Containerfile, so cargo-chef (#3) and sccache (#2) become throwaway work — nix build derivation caching replaces both. Do not start these until #11 is decided. If #11 does not proceed, these remain valid.
Superseded by #11 (migrate to dynamic-nix). dynamic-nix has no Containerfile, so cargo-chef (#3) and sccache (#2) become throwaway work — nix build derivation caching replaces both. Do not start these until #11 is decided. If #11 does not proceed, these remain valid.