aboutsummaryrefslogtreecommitdiff
path: root/src/nix/installables.cc
diff options
context:
space:
mode:
authorCarlo Nucera <carlo.nucera@protonmail.com>2020-07-31 13:12:51 -0400
committerCarlo Nucera <carlo.nucera@protonmail.com>2020-07-31 13:12:51 -0400
commitb6d97fdbf4f668d72e93e94e956a19ddb299bcd2 (patch)
tree56cfa7cf92b3684d24f7f0c3ed7c4637e54b499f /src/nix/installables.cc
parent2c7557481b4c9d5113a65cc7a75c8acc18031f4e (diff)
parenta3f9625818ecb0c8a3c22c191340dac5a3120bb5 (diff)
Merge branch 'master' of github.com:NixOS/nix into drv-outputs-map-allow-missing
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r--src/nix/installables.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index a13e5a3df..babb0e5fe 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -276,7 +276,7 @@ std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
Installable::getCursors(EvalState & state, bool useEvalCache)
{
auto evalCache =
- std::make_shared<nix::eval_cache::EvalCache>(false, Hash(), state,
+ std::make_shared<nix::eval_cache::EvalCache>(std::nullopt, state,
[&]() { return toValue(state).first; });
return {{evalCache->getRoot(), ""}};
}
@@ -304,8 +304,9 @@ struct InstallableStorePath : Installable
{
if (storePath.isDerivation()) {
std::map<std::string, StorePath> outputs;
- for (auto & [name, output] : store->readDerivation(storePath).outputs)
- outputs.emplace(name, output.path);
+ auto drv = store->readDerivation(storePath);
+ for (auto & [name, output] : drv.outputs)
+ outputs.emplace(name, output.path(*store, drv.name));
return {
Buildable {
.drvPath = storePath,
@@ -436,9 +437,11 @@ ref<eval_cache::EvalCache> openEvalCache(
std::shared_ptr<flake::LockedFlake> lockedFlake,
bool useEvalCache)
{
- return ref(std::make_shared<nix::eval_cache::EvalCache>(
- useEvalCache && evalSettings.pureEval,
- lockedFlake->getFingerprint(),
+ auto fingerprint = lockedFlake->getFingerprint();
+ return make_ref<nix::eval_cache::EvalCache>(
+ useEvalCache && evalSettings.pureEval
+ ? std::optional { std::cref(fingerprint) }
+ : std::nullopt,
state,
[&state, lockedFlake]()
{
@@ -456,7 +459,7 @@ ref<eval_cache::EvalCache> openEvalCache(
assert(aOutputs);
return aOutputs->value;
- }));
+ });
}
static std::string showAttrPaths(const std::vector<std::string> & paths)
@@ -642,7 +645,7 @@ std::shared_ptr<Installable> SourceExprCommand::parseInstallable(
}
Buildables build(ref<Store> store, Realise mode,
- std::vector<std::shared_ptr<Installable>> installables)
+ std::vector<std::shared_ptr<Installable>> installables, BuildMode bMode)
{
if (mode == Realise::Nothing)
settings.readOnlyMode = true;
@@ -668,7 +671,7 @@ Buildables build(ref<Store> store, Realise mode,
if (mode == Realise::Nothing)
printMissing(store, pathsToBuild, lvlError);
else if (mode == Realise::Outputs)
- store->buildPaths(pathsToBuild);
+ store->buildPaths(pathsToBuild, bMode);
return buildables;
}