diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-03-14 14:17:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 14:17:50 +0100 |
commit | a61809722fc85a803d412d66667e02e35a8d229a (patch) | |
tree | f23e55b25a211da532382831c619410d0566fe42 /src | |
parent | 0e86ebf46140fd8ea535d6be04549987c1ae4afe (diff) | |
parent | cb1a76112eb77883038ebad8d3b0e39330bdf1b3 (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.cc | 7 |
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. */ |