aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-18 02:07:31 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-18 14:59:56 +0000
commit8496be7defed3584c9fcd3b5d905fb84a9515d6f (patch)
treee4d2995f05530a531232d434ebfe94f15f9f1ed5 /src
parente433e42c5aa869c499d6289a121299bbd72fd160 (diff)
Use Deferred when building an input-addressed drv
Easier than using dummy path with input addressed.
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops.cc22
-rw-r--r--src/nix/develop.cc4
2 files changed, 9 insertions, 17 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 4f9b6f0e0..489bee826 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1194,9 +1194,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
for (auto & i : outputs) {
drv.env[i] = "";
drv.outputs.insert_or_assign(i,
- DerivationOutput::InputAddressed {
- .path = StorePath::dummy,
- });
+ DerivationOutput::Deferred { });
}
// Regular, non-CA derivation should always return a single hash and not
@@ -1207,19 +1205,15 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
auto & h = drvHash.hash;
switch (drvHash.kind) {
case DrvHash::Kind::Deferred:
- for (auto & i : outputs) {
- drv.outputs.insert_or_assign(i,
- DerivationOutput::Deferred { });
- }
+ /* Outputs already deferred, nothing to do */
break;
case DrvHash::Kind::Regular:
- for (auto & i : outputs) {
- auto outPath = state.store->makeOutputPath(i, h, drvName);
- drv.env[i] = state.store->printStorePath(outPath);
- drv.outputs.insert_or_assign(i,
- DerivationOutput::InputAddressed {
- .path = std::move(outPath),
- });
+ for (auto & [outputName, output] : drv.outputs) {
+ auto outPath = state.store->makeOutputPath(outputName, h, drvName);
+ drv.env[outputName] = state.store->printStorePath(outPath);
+ output = DerivationOutput::InputAddressed {
+ .path = std::move(outPath),
+ };
}
break;
}
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 6baf539c3..d2f9b5a6a 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -201,9 +201,7 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
}
} else {
for (auto & output : drv.outputs) {
- output.second = DerivationOutput::InputAddressed {
- .path = StorePath::dummy,
- };
+ output.second = DerivationOutput::Deferred { };
drv.env[output.first] = "";
}
auto h0 = hashDerivationModulo(*evalStore, drv, true);