libstore: optionally set the NIX_DEBUG environment variable

This commit is contained in:
Philip Taron 2024-07-31 16:22:15 -07:00
parent c347d3df8f
commit 2ee7866198
Signed by: philiptaron
SSH key fingerprint: SHA256:eMrR42ppULsfzeEDrP9+8JcsoaWZQy+mTkecD4oTTrU

View file

@ -912,6 +912,16 @@ void LocalDerivationGoal::initEnv()
/* Trigger colored output in various tools. */
env["TERM"] = "xterm-256color";
#ifdef NIX_DEBUG_ENVIRONMENT_VARIABLE
/*
* Allows controlling the NIX_DEBUG environment variable. In the Nixpkgs stdenv, when
* `NIX_DEBUG` is set to 1 or greater, more informative information is included in the logs.
*
* See https://nixos.org/manual/nixpkgs/stable/#var-stdenv-NIX_DEBUG
*/
env["NIX_DEBUG"] = fmt("%d", NIX_DEBUG_ENVIRONMENT_VARIABLE);
#endif
}