aboutsummaryrefslogtreecommitdiff
path: root/src/nix/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r--src/nix/build.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc
index 840c7ca38..9c648d28e 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -4,6 +4,7 @@
#include "shared.hh"
#include "store-api.hh"
#include "local-fs-store.hh"
+#include "progress-bar.hh"
#include <nlohmann/json.hpp>
@@ -12,6 +13,7 @@ using namespace nix;
struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
{
Path outLink = "result";
+ bool printOutputPaths = false;
BuildMode buildMode = bmNormal;
CmdBuild()
@@ -32,6 +34,12 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
});
addFlag({
+ .longName = "print-out-paths",
+ .description = "Print the resulting output paths",
+ .handler = {&printOutputPaths, true},
+ });
+
+ addFlag({
.longName = "rebuild",
.description = "Rebuild an already built package and compare the result to the existing store paths.",
.handler = {&buildMode, bmCheck},
@@ -93,6 +101,22 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
}, buildable.raw());
}
+ if (printOutputPaths) {
+ stopProgressBar();
+ for (auto & buildable : buildables) {
+ std::visit(overloaded {
+ [&](const BuiltPath::Opaque & bo) {
+ std::cout << store->printStorePath(bo.path) << std::endl;
+ },
+ [&](const BuiltPath::Built & bfd) {
+ for (auto & output : bfd.outputs) {
+ std::cout << store->printStorePath(output.second) << std::endl;
+ }
+ },
+ }, buildable.raw());
+ }
+ }
+
updateProfile(buildables);
}
};