aboutsummaryrefslogtreecommitdiff
path: root/src/nix/develop.cc
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane@hufschmitt.net>2022-03-16 14:21:09 +0100
committerThéophane Hufschmitt <theophane@hufschmitt.net>2022-03-29 18:17:35 +0200
commit390269ed8784b1a73a3310e63eb96a4b62861654 (patch)
tree15520077ec0d9083301cd44ab4d7b5edbf4927d8 /src/nix/develop.cc
parent2d572a250f5eef8bfe223c8e5196cce9e85d73f7 (diff)
Simplify the handling of the hash modulo
Rather than having four different but very similar types of hashes, make only one, with a tag indicating whether it corresponds to a regular of deferred derivation. This implies a slight logical change: The original Nix+multiple-outputs model assumed only one hash-modulo per derivation. Adding multiple-outputs CA derivations changed this as these have one hash-modulo per output. This change is now treating each derivation as having one hash modulo per output. This obviously means that we internally loose the guaranty that all the outputs of input-addressed derivations have the same hash modulo. But it turns out that it doesn’t matter because there’s nothing in the code taking advantage of that fact (and it probably shouldn’t anyways). The upside is that it is now much easier to work with these hashes, and we can get rid of a lot of useless `std::visit{ overloaded`. Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
Diffstat (limited to 'src/nix/develop.cc')
-rw-r--r--src/nix/develop.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index d2f9b5a6a..7fc74d34e 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -204,10 +204,10 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
output.second = DerivationOutput::Deferred { };
drv.env[output.first] = "";
}
- auto h0 = hashDerivationModulo(*evalStore, drv, true);
- const Hash & h = h0.requireNoFixedNonDeferred();
+ auto hashesModulo = hashDerivationModulo(*evalStore, drv, true);
for (auto & output : drv.outputs) {
+ Hash h = hashesModulo.hashes.at(output.first);
auto outPath = store->makeOutputPath(output.first, h, drv.name);
output.second = DerivationOutput::InputAddressed {
.path = outPath,