diff options
author | Matthew Kenigsberg <matthewkenigsberg@gmail.com> | 2020-10-22 23:59:01 -0500 |
---|---|---|
committer | Matthew Kenigsberg <matthewkenigsberg@gmail.com> | 2020-11-11 10:27:02 -0600 |
commit | 8abb80a478116b10bf37162c71f602262de412a9 (patch) | |
tree | 4abd6da99826d85b4e9d10167eab2b585c868ef3 /src/nix/build.cc | |
parent | 21830cb0447f2ad3d436a8b9df43222a787bb80e (diff) |
Print built derivations as json for build
Add --json option to nix build to allow machine readable output on
stdout with all built derivations
Fixes #1930
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r-- | src/nix/build.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc index 65708e98b..67be4024b 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -5,9 +5,11 @@ #include "store-api.hh" #include "local-fs-store.hh" +#include <nlohmann/json.hpp> + using namespace nix; -struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile +struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile { Path outLink = "result"; BuildMode buildMode = bmNormal; @@ -86,6 +88,8 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile }, buildables[i]); updateProfile(buildables); + + if (json) logger->cout("%s", buildablesToJSON(buildables, store).dump()); } }; |