aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/develop.cc2
-rw-r--r--src/nix/show-derivation.cc16
2 files changed, 13 insertions, 5 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index a0c119e43..12658078a 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -135,7 +135,7 @@ StorePath getDerivationEnvironment(ref<Store> store, const StorePath & drvPath)
drv.env["_outputs_saved"] = drv.env["outputs"];
drv.env["outputs"] = "out";
drv.inputSrcs.insert(std::move(getEnvShPath));
- Hash h = hashDerivationModulo(*store, drv, true);
+ Hash h = std::get<0>(hashDerivationModulo(*store, drv, true));
auto shellOutPath = store->makeOutputPath("out", h, drvName);
drv.outputs.insert_or_assign("out", DerivationOutput { .output = DerivationOutputInputAddressed {
.path = shellOutPath
diff --git a/src/nix/show-derivation.cc b/src/nix/show-derivation.cc
index 9fd26e2d7..25ea19834 100644
--- a/src/nix/show-derivation.cc
+++ b/src/nix/show-derivation.cc
@@ -70,10 +70,18 @@ struct CmdShowDerivation : InstallablesCommand
for (auto & output : drv.outputs) {
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));
- }
+
+ std::visit(overloaded {
+ [&](DerivationOutputInputAddressed doi) {
+ },
+ [&](DerivationOutputFixed dof) {
+ outputObj.attr("hashAlgo", dof.hash.printMethodAlgo());
+ outputObj.attr("hash", dof.hash.hash.to_string(Base16, false));
+ },
+ [&](DerivationOutputFloating dof) {
+ outputObj.attr("hashAlgo", makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType));
+ },
+ }, output.second.output);
}
}