diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-18 14:36:44 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-18 14:36:44 +0000 |
commit | 950ddfdb823891136043ae22dce0c66424c57b9d (patch) | |
tree | 0c7adf760042911b5631125a22fc8d53fe19ca0d /src/nix/show-derivation.cc | |
parent | 9357512d7379337c3636fa495ad7b4bbe3d8266d (diff) | |
parent | 1c8b550e34414d0f4cb0fa20322a2dfe06ce2de0 (diff) |
Merge remote-tracking branch 'upstream/master' into derivation-header-include-order
Diffstat (limited to 'src/nix/show-derivation.cc')
-rw-r--r-- | src/nix/show-derivation.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/nix/show-derivation.cc b/src/nix/show-derivation.cc index 9fd26e2d7..8c4bfb03e 100644 --- a/src/nix/show-derivation.cc +++ b/src/nix/show-derivation.cc @@ -67,13 +67,21 @@ struct CmdShowDerivation : InstallablesCommand { auto outputsObj(drvObj.object("outputs")); - for (auto & output : drv.outputs) { + for (auto & output : drv.outputsAndPaths(*store)) { auto outputObj(outputsObj.object(output.first)); - outputObj.attr("path", store->printStorePath(output.second.path(*store, drv.name))); - if (auto hash = std::get_if<DerivationOutputFixed>(&output.second.output)) { - outputObj.attr("hashAlgo", hash->hash.printMethodAlgo()); - outputObj.attr("hash", hash->hash.hash.to_string(Base16, false)); - } + outputObj.attr("path", store->printStorePath(output.second.second)); + + std::visit(overloaded { + [&](DerivationOutputInputAddressed doi) { + }, + [&](DerivationOutputCAFixed dof) { + outputObj.attr("hashAlgo", dof.hash.printMethodAlgo()); + outputObj.attr("hash", dof.hash.hash.to_string(Base16, false)); + }, + [&](DerivationOutputCAFloating dof) { + outputObj.attr("hashAlgo", makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType)); + }, + }, output.second.first.output); } } |