summaryrefslogtreecommitdiffstats
path: root/systems
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-28 18:28:23 +0000
committertv <tv@krebsco.de>2026-11-28 18:28:23 +0000
commit8fccb9b641f6c31a7928d2d3d84e786d3946d2a5 (patch)
tree439465aedc9a8d15f9e200587fe5403f69461419 /systems
parent584b4584ca12b269ff3b88538db781d6f99cd34f (diff)
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.
Diffstat (limited to 'systems')
-rw-r--r--systems/qi/base.nix32
1 files changed, 26 insertions, 6 deletions
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 [ ];