ccache: option to allow silencing per-derivation trace

Currently the ccache wrapper prints a trace for each derivation
wrapped. In some contexts this can be distracting; for example, on
nix-output-monitor those traces seem to permanently occupy screen
space that could be used on other information, and they can drown
other important traces.

Add an option, `programs.ccache.trace`, to allow silencing those
traces. For maximum backwards compatibility, default to the current
behavior (`programs.ccache.trace = true`).
This commit is contained in:
Sami Liedes
2025-09-28 08:23:50 +02:00
parent e643668fd7
commit e7ca3db326
+10 -1
View File
@@ -38,6 +38,11 @@ in
default = "nixbld";
description = "Group owner of CCache directory";
};
trace = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Trace ccache usage to see which derivations use ccache";
};
};
config = lib.mkMerge [
@@ -73,7 +78,11 @@ in
(
self: super:
lib.genAttrs cfg.packageNames (
pn: super.${pn}.override { stdenv = builtins.trace "with ccache: ${pn}" self.ccacheStdenv; }
pn:
super.${pn}.override {
stdenv =
if cfg.trace then builtins.trace "with ccache: ${pn}" self.ccacheStdenv else self.ccacheStdenv;
}
)
)