libexpr: print flake config warning to stderr

Fixes #1155

Change-Id: Ie63f9200f7c06b1eec6c52518d6f523f6a6a6964
(cherry picked from commit f87d753987)
This commit is contained in:
Linus Heckemann
2026-03-17 12:48:02 +00:00
committed by eldritch horrors
parent c08f2336d0
commit 7166c00efc
2 changed files with 13 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
---
synopsis: "flake config warnings are now printed to stderr"
issues: [1155]
cls: [5379]
category: "Fixes"
credits: [lheckemann]
---
The settings listed in a flake-config confirmation prompt are now printed to stderr rather than stdout, which allows `nix print-dev-env` to emit valid bash again even in the presence of untrusted settings.
+4 -2
View File
@@ -35,12 +35,14 @@ static bool batchAskForSetting(
TrustedList & trustedList,
std::map<std::string, std::string> & untrustedSettings)
{
printWarning("The following settings require your decision:");
std::string warning("The following settings require your decision:");
for (const auto & [name, valueS] : untrustedSettings) {
// FIXME: filter ANSI escapes, newlines, \r, etc.
logger->cout("- %s = %s", name, valueS);
warning += fmt("\n- %s = %s", name, valueS);
}
printWarning("%s", warning);
auto reply = logger
->ask(
fmt("Do you want to allow configuration settings to be applied?\nThis may allow the "