aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-08-05 16:27:15 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-08-05 16:27:15 +0000
commita9bbfaa8515de7107457fda2a7aef87aa198788e (patch)
tree62bb50e4cc16e0e56c37d25c1459bfb35932b7b1
parentd89472a912c28ec3d47378bb3a6822cd733778f5 (diff)
Fix --profile with multiple opaque paths
-rw-r--r--src/nix/command.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc
index 04715b43a..da32819da 100644
--- a/src/nix/command.cc
+++ b/src/nix/command.cc
@@ -128,27 +128,25 @@ void MixProfile::updateProfile(const Buildables & buildables)
{
if (!profile) return;
- std::optional<StorePath> result;
+ std::vector<StorePath> result;
for (auto & buildable : buildables) {
std::visit(overloaded {
[&](BuildableOpaque bo) {
- result = bo.path;
+ result.push_back(bo.path);
},
[&](BuildableFromDrv bfd) {
for (auto & output : bfd.outputs) {
- if (result)
- throw Error("'--profile' requires that the arguments produce a single store path, but there are multiple");
- result = output.second;
+ result.push_back(output.second);
}
},
}, buildable);
}
- if (!result)
- throw Error("'--profile' requires that the arguments produce a single store path, but there are none");
+ if (result.size() != 1)
+ throw Error("'--profile' requires that the arguments produce a single store path, but there are %d", result.size());
- updateProfile(*result);
+ updateProfile(result[0]);
}
MixDefaultProfile::MixDefaultProfile()