diff --git a/src/nix/installables.cc b/src/nix/installables.cc index c41aa859c..01be68cdb 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -440,6 +440,16 @@ ref openEvalCache( })); } +static std::string showAttrPaths(const std::vector & paths) +{ + std::string s; + for (const auto & [n, i] : enumerate(paths)) { + if (n > 0) s += n + 1 == paths.size() ? " or " : ", "; + s += '\''; s += i; s += '\''; + } + return s; +} + std::tuple InstallableFlake::toDerivation() { @@ -477,7 +487,7 @@ std::tuple InstallableF } throw Error("flake '%s' does not provide attribute %s", - flakeRef, concatStringsSep(", ", quoteStrings(attrPaths))); + flakeRef, showAttrPaths(getActualAttrPaths())); } std::vector InstallableFlake::toDerivations() @@ -505,7 +515,7 @@ std::pair InstallableFlake::toValue(EvalState & state) } throw Error("flake '%s' does not provide attribute %s", - flakeRef, concatStringsSep(", ", quoteStrings(attrPaths))); + flakeRef, showAttrPaths(getActualAttrPaths())); } std::vector, std::string>>