Skip to content

Commit 0414ae6

Browse files
authored
Merge pull request #1531 from NixOS/nix-2.32
Bump Nix 2.32
2 parents 524b232 + 449791b commit 0414ae6

File tree

3 files changed

+100
-80
lines changed

3 files changed

+100
-80
lines changed

flake.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
55

66
inputs.nix = {
7-
url = "github:NixOS/nix/2.31-maintenance";
7+
url = "github:NixOS/nix/2.32-maintenance";
88
# We want to control the deps precisely
99
flake = false;
1010
};
1111

1212
inputs.nix-eval-jobs = {
13-
url = "github:nix-community/nix-eval-jobs/v2.31.0";
13+
url = "github:nix-community/nix-eval-jobs/v2.32.1";
1414
# We want to control the deps precisely
1515
flake = false;
1616
};

src/hydra-queue-runner/build-remote.cc

Lines changed: 90 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <nix/util/current-process.hh>
1515
#include <nix/util/processes.hh>
1616
#include <nix/util/util.hh>
17+
#include <nix/store/export-import.hh>
1718
#include <nix/store/serve-protocol.hh>
1819
#include <nix/store/serve-protocol-impl.hh>
1920
#include <nix/store/ssh.hh>
@@ -104,7 +105,7 @@ static void copyClosureTo(
104105
std::chrono::seconds(600));
105106

106107
conn.importPaths(destStore, [&](Sink & sink) {
107-
destStore.exportPaths(missing, sink);
108+
exportPaths(destStore, missing, sink);
108109
});
109110

110111
if (readInt(conn.from) != 1)
@@ -262,16 +263,18 @@ static BuildResult performBuild(
262263
// Since this a `BasicDerivation`, `staticOutputHashes` will not
263264
// do any real work.
264265
auto outputHashes = staticOutputHashes(localStore, drv);
265-
for (auto & [outputName, output] : drvOutputs) {
266-
auto outputPath = output.second;
267-
// We’ve just asserted that the output paths of the derivation
268-
// were known
269-
assert(outputPath);
270-
auto outputHash = outputHashes.at(outputName);
271-
auto drvOutput = DrvOutput { outputHash, outputName };
272-
result.builtOutputs.insert_or_assign(
273-
std::move(outputName),
274-
Realisation { drvOutput, *outputPath });
266+
if (auto * successP = result.tryGetSuccess()) {
267+
for (auto & [outputName, output] : drvOutputs) {
268+
auto outputPath = output.second;
269+
// We’ve just asserted that the output paths of the derivation
270+
// were known
271+
assert(outputPath);
272+
auto outputHash = outputHashes.at(outputName);
273+
auto drvOutput = DrvOutput { outputHash, outputName };
274+
successP->builtOutputs.insert_or_assign(
275+
std::move(outputName),
276+
Realisation { drvOutput, *outputPath });
277+
}
275278
}
276279
}
277280

@@ -335,54 +338,68 @@ void RemoteResult::updateWithBuildResult(const nix::BuildResult & buildResult)
335338
startTime = buildResult.startTime;
336339
stopTime = buildResult.stopTime;
337340
timesBuilt = buildResult.timesBuilt;
338-
errorMsg = buildResult.errorMsg;
339-
isNonDeterministic = buildResult.isNonDeterministic;
340341

341-
switch ((BuildResult::Status) buildResult.status) {
342-
case BuildResult::Built:
343-
stepStatus = bsSuccess;
344-
break;
345-
case BuildResult::Substituted:
346-
case BuildResult::AlreadyValid:
342+
std::visit(overloaded{
343+
[&](const BuildResult::Success & success) {
347344
stepStatus = bsSuccess;
348-
isCached = true;
349-
break;
350-
case BuildResult::PermanentFailure:
351-
stepStatus = bsFailed;
352-
canCache = true;
353-
errorMsg = "";
354-
break;
355-
case BuildResult::InputRejected:
356-
case BuildResult::OutputRejected:
357-
stepStatus = bsFailed;
358-
canCache = true;
359-
break;
360-
case BuildResult::TransientFailure:
361-
stepStatus = bsFailed;
362-
canRetry = true;
363-
errorMsg = "";
364-
break;
365-
case BuildResult::TimedOut:
366-
stepStatus = bsTimedOut;
367-
errorMsg = "";
368-
break;
369-
case BuildResult::MiscFailure:
370-
stepStatus = bsAborted;
371-
canRetry = true;
372-
break;
373-
case BuildResult::LogLimitExceeded:
374-
stepStatus = bsLogLimitExceeded;
375-
break;
376-
case BuildResult::NotDeterministic:
377-
stepStatus = bsNotDeterministic;
378-
canRetry = false;
379-
canCache = true;
380-
break;
381-
default:
382-
stepStatus = bsAborted;
383-
break;
384-
}
385-
345+
switch (success.status) {
346+
case BuildResult::Success::Built:
347+
break;
348+
case BuildResult::Success::Substituted:
349+
case BuildResult::Success::AlreadyValid:
350+
case BuildResult::Success::ResolvesToAlreadyValid:
351+
isCached = true;
352+
break;
353+
default:
354+
assert(false);
355+
}
356+
},
357+
[&](const BuildResult::Failure & failure) {
358+
errorMsg = failure.errorMsg;
359+
isNonDeterministic = failure.isNonDeterministic;
360+
switch (failure.status) {
361+
case BuildResult::Failure::PermanentFailure:
362+
stepStatus = bsFailed;
363+
canCache = true;
364+
errorMsg = "";
365+
break;
366+
case BuildResult::Failure::InputRejected:
367+
case BuildResult::Failure::OutputRejected:
368+
stepStatus = bsFailed;
369+
canCache = true;
370+
break;
371+
case BuildResult::Failure::TransientFailure:
372+
stepStatus = bsFailed;
373+
canRetry = true;
374+
errorMsg = "";
375+
break;
376+
case BuildResult::Failure::TimedOut:
377+
stepStatus = bsTimedOut;
378+
errorMsg = "";
379+
break;
380+
case BuildResult::Failure::MiscFailure:
381+
stepStatus = bsAborted;
382+
canRetry = true;
383+
break;
384+
case BuildResult::Failure::LogLimitExceeded:
385+
stepStatus = bsLogLimitExceeded;
386+
break;
387+
case BuildResult::Failure::NotDeterministic:
388+
stepStatus = bsNotDeterministic;
389+
canRetry = false;
390+
canCache = true;
391+
break;
392+
case BuildResult::Failure::CachedFailure:
393+
case BuildResult::Failure::DependencyFailed:
394+
case BuildResult::Failure::NoSubstituters:
395+
case BuildResult::Failure::HashMismatch:
396+
stepStatus = bsAborted;
397+
break;
398+
default:
399+
assert(false);
400+
}
401+
},
402+
}, buildResult.inner);
386403
}
387404

388405
/* Utility guard object to auto-release a semaphore on destruction. */
@@ -404,7 +421,7 @@ void State::buildRemote(ref<Store> destStore,
404421
std::function<void(StepState)> updateStep,
405422
NarMemberDatas & narMembers)
406423
{
407-
assert(BuildResult::TimedOut == 8);
424+
assert(BuildResult::Failure::TimedOut == 8);
408425

409426
auto [logFile, logFD] = build_remote::openLogFile(logDir, step->drvPath);
410427
AutoDelete logFileDel(logFile, false);
@@ -513,7 +530,7 @@ void State::buildRemote(ref<Store> destStore,
513530

514531
updateStep(ssBuilding);
515532

516-
BuildResult buildResult = build_remote::performBuild(
533+
auto buildResult = build_remote::performBuild(
517534
conn,
518535
*localStore,
519536
step->drvPath,
@@ -555,8 +572,9 @@ void State::buildRemote(ref<Store> destStore,
555572
wakeDispatcher();
556573

557574
StorePathSet outputs;
558-
for (auto & [_, realisation] : buildResult.builtOutputs)
559-
outputs.insert(realisation.outPath);
575+
if (auto * successP = buildResult.tryGetSuccess())
576+
for (auto & [_, realisation] : successP->builtOutputs)
577+
outputs.insert(realisation.outPath);
560578

561579
/* Copy the output paths. */
562580
if (!machine->isLocalhost() || localStore != std::shared_ptr<Store>(destStore)) {
@@ -589,15 +607,17 @@ void State::buildRemote(ref<Store> destStore,
589607
/* Register the outputs of the newly built drv */
590608
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
591609
auto outputHashes = staticOutputHashes(*localStore, *step->drv);
592-
for (auto & [outputName, realisation] : buildResult.builtOutputs) {
593-
// Register the resolved drv output
594-
destStore->registerDrvOutput(realisation);
595-
596-
// Also register the unresolved one
597-
auto unresolvedRealisation = realisation;
598-
unresolvedRealisation.signatures.clear();
599-
unresolvedRealisation.id.drvHash = outputHashes.at(outputName);
600-
destStore->registerDrvOutput(unresolvedRealisation);
610+
if (auto * successP = buildResult.tryGetSuccess()) {
611+
for (auto & [outputName, realisation] : successP->builtOutputs) {
612+
// Register the resolved drv output
613+
destStore->registerDrvOutput(realisation);
614+
615+
// Also register the unresolved one
616+
auto unresolvedRealisation = realisation;
617+
unresolvedRealisation.signatures.clear();
618+
unresolvedRealisation.id.drvHash = outputHashes.at(outputName);
619+
destStore->registerDrvOutput(unresolvedRealisation);
620+
}
601621
}
602622
}
603623

0 commit comments

Comments
 (0)