From 45f3d5a117f336299a34ca1c6eea778da419200a Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 5 Mar 2023 03:50:04 +0000 Subject: [PATCH] ccache: default to 50G cache --- hosts/modules/roles/build-machine.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hosts/modules/roles/build-machine.nix b/hosts/modules/roles/build-machine.nix index 25ebd6b7..8459680b 100644 --- a/hosts/modules/roles/build-machine.nix +++ b/hosts/modules/roles/build-machine.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, sane-lib, ... }: let inherit (lib) mkIf mkOption types; @@ -19,11 +19,19 @@ in # granular compilation cache # docs: - # investigate the cache with `nix-cache --show-stats` + # investigate the cache with: + # - `nix-ccache --show-stats` + # - `build '.#ccache' + # - `sudo CCACHE_DIR=/var/cache/ccache ./result/bin/ccache --show-stats -v` + # TODO: whitelist `--verbose` in + # TODO: configure without compression (leverage fs-level compression), and enable file-clone (i.e. hardlinks) programs.ccache.enable = true; sane.persist.sys.plaintext = [ { group = "nixbld"; mode = "0775"; directory = config.programs.ccache.cacheDir; } ]; + sane.fs."/var/cache/ccache/ccache.conf" = sane-lib.fs.wantedText '' + max_size = 50G + ''; nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ]; programs.ccache.packageNames = [ # these have to exist in toplevel package set: