From a4436396b99efab7c6190198fe8e0a378dc03764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Tue, 28 Mar 2023 08:22:26 +0200 Subject: [PATCH] Don't recommend 'nix log' unless experimental feature is enabled This fixes the issue that `nix-build`, without experimental feature 'nix-command' enabled, recommends the experimental CLI `nix log` to view build logs. Now it'll recommend the stable `nix-store -l` CLI instead. Fixes https://github.com/NixOS/nix/issues/8118 --- src/libstore/build/derivation-goal.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 596034c0f4c3..2bef26b2d666 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -911,8 +911,15 @@ void DerivationGoal::buildDone() msg += line; msg += "\n"; } - msg += fmt("For full logs, run '" ANSI_BOLD "nix log %s" ANSI_NORMAL "'.", - worker.store.printStorePath(drvPath)); + msg += "For full logs, run '" ANSI_BOLD; + if (experimentalFeatureSettings.isEnabled(Xp::NixCommand)) { + msg += "nix log"; + } else { + msg += "nix-store -l"; + } + msg += " "; + msg += worker.store.printStorePath(drvPath); + msg += ANSI_NORMAL "'."; } if (diskFull)