Small refactor to avoid optional values
This commit is contained in:
parent
cc9fa47406
commit
ab07651f74
|
@ -154,12 +154,6 @@ static Value *releaseExprTopLevelValue(EvalState &state, Bindings &autoArgs) {
|
||||||
return vRoot;
|
return vRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *topLevelValue(EvalState &state, Bindings &autoArgs,
|
|
||||||
std::optional<InstallableFlake> flake) {
|
|
||||||
return flake.has_value() ? flake.value().toValue(state).first
|
|
||||||
: releaseExprTopLevelValue(state, autoArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool queryIsCached(Store &store, std::map<std::string, std::string> &outputs) {
|
bool queryIsCached(Store &store, std::map<std::string, std::string> &outputs) {
|
||||||
uint64_t downloadSize, narSize;
|
uint64_t downloadSize, narSize;
|
||||||
StorePathSet willBuild, willSubstitute, unknown;
|
StorePathSet willBuild, willSubstitute, unknown;
|
||||||
|
@ -264,22 +258,25 @@ std::string attrPathJoin(json input) {
|
||||||
static void worker(ref<EvalState> state, Bindings &autoArgs, AutoCloseFD &to,
|
static void worker(ref<EvalState> state, Bindings &autoArgs, AutoCloseFD &to,
|
||||||
AutoCloseFD &from) {
|
AutoCloseFD &from) {
|
||||||
|
|
||||||
std::optional<InstallableFlake> flake;
|
nix::Value *vRoot = [&]() {
|
||||||
if (myArgs.flake) {
|
if (myArgs.flake) {
|
||||||
auto [flakeRef, fragment, outputSpec] =
|
auto [flakeRef, fragment, outputSpec] =
|
||||||
parseFlakeRefWithFragmentAndExtendedOutputsSpec(myArgs.releaseExpr,
|
parseFlakeRefWithFragmentAndExtendedOutputsSpec(myArgs.releaseExpr,
|
||||||
absPath("."));
|
absPath("."));
|
||||||
|
InstallableFlake flake {
|
||||||
|
{}, state, std::move(flakeRef), fragment,
|
||||||
|
outputSpec, {}, {},
|
||||||
|
flake::LockFlags{
|
||||||
|
.updateLockFile = false,
|
||||||
|
.useRegistries = false,
|
||||||
|
.allowUnlocked = false,
|
||||||
|
}};
|
||||||
|
|
||||||
flake.emplace(InstallableFlake({}, state, std::move(flakeRef), fragment,
|
return flake.toValue(*state).first;
|
||||||
outputSpec, {}, {},
|
} else {
|
||||||
flake::LockFlags{
|
return releaseExprTopLevelValue(*state, autoArgs);
|
||||||
.updateLockFile = false,
|
}
|
||||||
.useRegistries = false,
|
}();
|
||||||
.allowUnlocked = false,
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
auto vRoot = topLevelValue(*state, autoArgs, flake);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Wait for the collector to send us a job name. */
|
/* Wait for the collector to send us a job name. */
|
||||||
|
|
Loading…
Reference in a new issue