aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-03-14 14:17:50 +0100
committerGitHub <noreply@github.com>2022-03-14 14:17:50 +0100
commita61809722fc85a803d412d66667e02e35a8d229a (patch)
treef23e55b25a211da532382831c619410d0566fe42 /src
parent0e86ebf46140fd8ea535d6be04549987c1ae4afe (diff)
parentcb1a76112eb77883038ebad8d3b0e39330bdf1b3 (diff)
Merge pull request #6244 from Artturin/nixenvbettermessage
nix-env: Add a suggestion for when there's a name collision in channels
Diffstat (limited to 'src')
-rw-r--r--src/nix-env/nix-env.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 40c3c5d65..eb5fbc08f 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -128,7 +128,12 @@ static void getAllExprs(EvalState & state,
if (hasSuffix(attrName, ".nix"))
attrName = std::string(attrName, 0, attrName.size() - 4);
if (!seen.insert(attrName).second) {
- printError("warning: name collision in input Nix expressions, skipping '%1%'", path2);
+ std::string suggestionMessage = "";
+ if (path2.find("channels") != std::string::npos && path.find("channels") != std::string::npos) {
+ suggestionMessage = fmt("\nsuggestion: remove '%s' from either the root channels or the user channels", attrName);
+ }
+ printError("warning: name collision in input Nix expressions, skipping '%1%'"
+ "%2%", path2, suggestionMessage);
continue;
}
/* Load the expression on demand. */