From 8fccb9b641f6c31a7928d2d3d84e786d3946d2a5 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 28 Nov 2026 18:28:23 +0000 Subject: qi: compile the kernel with ccache where the builder has one The wrapped compiler uses /var/cache/ccache if the build can write there, and plain compilation otherwise, so the kernel still builds on a builder without it. --- systems/qi/base.nix | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'systems/qi') diff --git a/systems/qi/base.nix b/systems/qi/base.nix index 73f17b4c..cc4377c0 100644 --- a/systems/qi/base.nix +++ b/systems/qi/base.nix @@ -11,16 +11,36 @@ krebs.shadow.overridesFile = "${config.krebs.secret.directory}/shadow-overrides"; - # Cross-compiled where the builder's system differs. - mobile.boot.stage-1.kernel.package = lib.mkForce ( - (import pkgs.path { + # Cross-compiled where the builder's system differs, with ccache where the + # builder has /var/cache/ccache in its sandbox. + mobile.boot.stage-1.kernel.package = lib.mkForce (let + buildPkgs = import pkgs.path { localSystem = buildSystem; crossSystem = pkgs.stdenv.hostPlatform.system; inherit (pkgs) config overlays; - }).callPackage + }; + stdenv = buildPkgs.ccacheStdenv.override { + extraConfig = /* sh */ '' + if [ -w /var/cache/ccache ]; then + export CCACHE_COMPRESS=1 + export CCACHE_DIR=/var/cache/ccache + export CCACHE_SLOPPINESS=random_seed + export CCACHE_UMASK=007 + else + export CCACHE_DIR=''${TMPDIR:-/tmp}/ccache + export CCACHE_DISABLE=1 + fi + ''; + }; + in + buildPkgs.callPackage (inputs.mobile-nixos + "/devices/families/sdm845-mainline/kernel") - { } - ); + { + mobile-nixos = buildPkgs.mobile-nixos // { + kernel-builder = + buildPkgs.mobile-nixos.kernel-builder.override { inherit stdenv; }; + }; + }); # The kernel has no modules. boot.kernelModules = lib.mkForce [ ]; -- cgit v1.3.1