From e7ca3db3260699e9929e4199a9231b2ab3bb4e9d Mon Sep 17 00:00:00 2001 From: Sami Liedes Date: Fri, 26 Sep 2025 21:11:06 +0200 Subject: [PATCH] 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`). --- nixos/modules/programs/ccache.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/programs/ccache.nix b/nixos/modules/programs/ccache.nix index 7dad40fcec2c..c758831c759e 100644 --- a/nixos/modules/programs/ccache.nix +++ b/nixos/modules/programs/ccache.nix @@ -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; + } ) )