From 59e4c84800f91f3ce375f40a55fb2771a88c28de Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 5 Mar 2023 03:13:11 +0000 Subject: [PATCH] build-machine: use ccache for some large packages --- hosts/modules/roles/build-machine.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hosts/modules/roles/build-machine.nix b/hosts/modules/roles/build-machine.nix index 8a8f3b5e..25ebd6b7 100644 --- a/hosts/modules/roles/build-machine.nix +++ b/hosts/modules/roles/build-machine.nix @@ -16,5 +16,24 @@ in # enable cross compilation boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; # nixpkgs.config.allowUnsupportedSystem = true; + + # granular compilation cache + # docs: + # investigate the cache with `nix-cache --show-stats` + programs.ccache.enable = true; + sane.persist.sys.plaintext = [ + { group = "nixbld"; mode = "0775"; directory = config.programs.ccache.cacheDir; } + ]; + nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ]; + programs.ccache.packageNames = [ + # these have to exist in toplevel package set: + # nixpkgs config creates an overlay which overrides each of these packages to build with ccache + # note a potential bootstrapping problem: if the cache directory above hasn't yet been created, then this blocks deployment. + # solution is to manually disable all these entries on the first deployment + # TODO: distribute these elsewhere; make sure it works on cross-compiled builds + "firefox-esr" + # "qtwebengine" + "webkitgtk" + ]; }; }