1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 06:22:42 +01:00

treewide: Apply clang-format

Nixpkgs bump in the flake bumps clang-format, so we now have a diff
compared to what was used to format the codebase previously. We should
have made sure that the nixpkgs input is the same in the first place.
This commit is contained in:
Sergei Zimmerman 2025-08-18 21:20:35 +03:00
parent 448bbbe0fd
commit 945d9d7264
No known key found for this signature in database
33 changed files with 428 additions and 356 deletions

View file

@ -505,8 +505,9 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
for (auto & s : ss) {
auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(s);
result.push_back(make_ref<InstallableAttrPath>(
InstallableAttrPath::parse(state, *this, vFile, std::move(prefix), std::move(extendedOutputsSpec))));
result.push_back(
make_ref<InstallableAttrPath>(InstallableAttrPath::parse(
state, *this, vFile, std::move(prefix), std::move(extendedOutputsSpec))));
}
} else {
@ -521,7 +522,8 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
if (prefix.find('/') != std::string::npos) {
try {
result.push_back(make_ref<InstallableDerivedPath>(
result.push_back(
make_ref<InstallableDerivedPath>(
InstallableDerivedPath::parse(store, prefix, extendedOutputsSpec.raw)));
continue;
} catch (BadStorePath &) {
@ -534,7 +536,8 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
try {
auto [flakeRef, fragment] =
parseFlakeRefWithFragment(fetchSettings, std::string{prefix}, absPath(getCommandBaseDir()));
result.push_back(make_ref<InstallableFlake>(
result.push_back(
make_ref<InstallableFlake>(
this,
getEvalState(),
std::move(flakeRef),
@ -610,7 +613,8 @@ static void throwBuildErrors(std::vector<KeyedBuildResult> & buildResults, const
StringSet failedPaths;
for (; failedResult != failed.end(); failedResult++) {
if (!failedResult->errorMsg.empty()) {
logError(ErrorInfo{
logError(
ErrorInfo{
.level = lvlError,
.msg = failedResult->errorMsg,
});

View file

@ -223,20 +223,23 @@ INSTANTIATE_TEST_SUITE_P(
#define X4(w, x, y, z) \
TEST_F(TrivialExpressionTest, nestedAttrsetMerge##w##x##y##z) \
{ \
auto v = eval("{ a.b = { c = 1; d = 2; }; } == { " X_EXPAND_IF##w( \
auto v = eval( \
"{ a.b = { c = 1; d = 2; }; } == { " X_EXPAND_IF##w( \
"a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " }"); \
ASSERT_THAT(v, IsTrue()); \
}; \
TEST_F(TrivialExpressionTest, nestedAttrsetMergeDup##w##x##y##z) \
{ \
ASSERT_THROW( \
eval("{ " X_EXPAND_IF##w("a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y( \
eval( \
"{ " X_EXPAND_IF##w("a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y( \
"a", X_EXPAND_IF##z("b", "c = 2;")) " }"), \
Error); \
}; \
TEST_F(TrivialExpressionTest, nestedAttrsetMergeLet##w##x##y##z) \
{ \
auto v = eval("{ b = { c = 1; d = 2; }; } == (let " X_EXPAND_IF##w( \
auto v = eval( \
"{ b = { c = 1; d = 2; }; } == (let " X_EXPAND_IF##w( \
"a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " in a)"); \
ASSERT_THAT(v, IsTrue()); \
};

View file

@ -185,8 +185,8 @@ struct AttrDb
auto state(_state->lock());
state->insertAttribute
.use()(key.first)(symbols[key.second])(AttrType::ListOfStrings)(
dropEmptyInitThenConcatStringsSep("\t", l))
.use()(key.first)(symbols[key.second])(
AttrType::ListOfStrings) (dropEmptyInitThenConcatStringsSep("\t", l))
.exec();
return state->db.getLastInsertedRowId();

View file

@ -44,7 +44,8 @@ EvalErrorBuilder<T> & EvalErrorBuilder<T>::withFrame(const Env & env, const Expr
// NOTE: This is abusing side-effects.
// TODO: check compatibility with nested debugger calls.
// TODO: What side-effects??
error.state.debugTraces.push_front(DebugTrace{
error.state.debugTraces.push_front(
DebugTrace{
.pos = expr.getPos(),
.expr = expr,
.env = env,

View file

@ -795,7 +795,8 @@ void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr &
printError("%s\n", error->what());
if (trylevel > 0 && error->info().level != lvlInfo)
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL
printError(
"This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL
" to skip these.\n");
}

View file

@ -68,7 +68,8 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
std::visit(
overloaded{
[&](const NixStringContextElem::Built & b) {
drvs.push_back(DerivedPath::Built{
drvs.push_back(
DerivedPath::Built{
.drvPath = b.drvPath,
.outputs = OutputsSpec::Names{b.output},
});
@ -117,7 +118,8 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
/* Get all the output paths corresponding to the placeholders we had */
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
res.insert_or_assign(
DownstreamPlaceholder::fromSingleDerivedPathBuilt(SingleDerivedPath::Built{
DownstreamPlaceholder::fromSingleDerivedPathBuilt(
SingleDerivedPath::Built{
.drvPath = drv.drvPath,
.output = outputName,
})
@ -297,7 +299,8 @@ static void import(EvalState & state, const PosIdx pos, Value & vPath, Value * v
}
}
static RegisterPrimOp primop_scopedImport(PrimOp{
static RegisterPrimOp primop_scopedImport(
PrimOp{
.name = "scopedImport", .arity = 2, .fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
import(state, pos, *args[1], args[0], v);
}});
@ -806,7 +809,8 @@ static void prim_genericClosure(EvalState & state, const PosIdx pos, Value ** ar
v.mkList(list);
}
static RegisterPrimOp primop_genericClosure(PrimOp{
static RegisterPrimOp primop_genericClosure(
PrimOp{
.name = "__genericClosure",
.args = {"attrset"},
.arity = 1,
@ -872,7 +876,8 @@ static RegisterPrimOp primop_break(
)",
.fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
if (state.canDebug()) {
auto error = Error(ErrorInfo{
auto error = Error(
ErrorInfo{
.level = lvlInfo,
.msg = HintFmt("breakpoint reached"),
.pos = state.positions[pos],
@ -940,7 +945,8 @@ static void prim_addErrorContext(EvalState & state, const PosIdx pos, Value ** a
}
}
static RegisterPrimOp primop_addErrorContext(PrimOp{
static RegisterPrimOp primop_addErrorContext(
PrimOp{
.name = "__addErrorContext",
.arity = 2,
// The normal trace item is redundant
@ -1656,7 +1662,8 @@ static void derivationStrictInternal(EvalState & state, const std::string & drvN
v.mkAttrs(result);
}
static RegisterPrimOp primop_derivationStrict(PrimOp{
static RegisterPrimOp primop_derivationStrict(
PrimOp{
.name = "derivationStrict",
.arity = 1,
.fun = prim_derivationStrict,
@ -1898,7 +1905,8 @@ static void prim_readFile(EvalState & state, const PosIdx pos, Value ** args, Va
}
NixStringContext context;
for (auto && p : std::move(refs)) {
context.insert(NixStringContextElem::Opaque{
context.insert(
NixStringContextElem::Opaque{
.path = std::move((StorePath &&) p),
});
}
@ -1956,7 +1964,8 @@ static void prim_findFile(EvalState & state, const PosIdx pos, Value ** args, Va
.debugThrow();
}
lookupPath.elements.emplace_back(LookupPath::Elem{
lookupPath.elements.emplace_back(
LookupPath::Elem{
.prefix = LookupPath::Prefix{.s = prefix},
.path = LookupPath::Path{.s = path},
});
@ -1968,7 +1977,8 @@ static void prim_findFile(EvalState & state, const PosIdx pos, Value ** args, Va
v.mkPath(state.findFile(lookupPath, path, pos));
}
static RegisterPrimOp primop_findFile(PrimOp{
static RegisterPrimOp primop_findFile(
PrimOp{
.name = "__findFile",
.args = {"search-path", "lookup-path"},
.doc = R"(
@ -2871,7 +2881,8 @@ static void prim_unsafeGetAttrPos(EvalState & state, const PosIdx pos, Value **
state.mkPos(v, i->pos);
}
static RegisterPrimOp primop_unsafeGetAttrPos(PrimOp{
static RegisterPrimOp primop_unsafeGetAttrPos(
PrimOp{
.name = "__unsafeGetAttrPos",
.arity = 2,
.fun = prim_unsafeGetAttrPos,

View file

@ -276,7 +276,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
if (auto attr = i.value->attrs()->get(sPath)) {
if (state.forceBool(*attr->value, attr->pos, "while evaluating the `path` attribute of a string context"))
context.emplace(NixStringContextElem::Opaque{
context.emplace(
NixStringContextElem::Opaque{
.path = namePath,
});
}
@ -291,7 +292,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
.atPos(i.pos)
.debugThrow();
}
context.emplace(NixStringContextElem::DrvDeep{
context.emplace(
NixStringContextElem::DrvDeep{
.drvPath = namePath,
});
}
@ -309,7 +311,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
for (auto elem : attr->value->listItems()) {
auto outputName =
state.forceStringNoCtx(*elem, attr->pos, "while evaluating an output name within a string context");
context.emplace(NixStringContextElem::Built{
context.emplace(
NixStringContextElem::Built{
.drvPath = makeConstantStorePathRef(namePath),
.output = std::string{outputName},
});

View file

@ -44,7 +44,8 @@ static void downloadToSink(
static std::string getLfsApiToken(const ParsedURL & url)
{
auto [status, output] = runProgram(RunOptions{
auto [status, output] = runProgram(
RunOptions{
.program = "ssh",
.args = {*url.authority, "git-lfs-authenticate", url.path, "download"},
});

View file

@ -389,7 +389,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
continue;
std::string key2(key, 0, key.size() - 5);
auto path = CanonPath(value);
result.push_back(Submodule{
result.push_back(
Submodule{
.path = path,
.url = entries[key2 + ".url"],
.branch = entries[key2 + ".branch"],
@ -533,7 +534,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
append(gitArgs, {"--depth", "1"});
append(gitArgs, {std::string("--"), url, refspec});
runProgram(RunOptions{
runProgram(
RunOptions{
.program = "git",
.lookupPath = true,
// FIXME: git stderr messes up our progress indicator, so
@ -566,7 +568,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
writeFile(allowedSignersFile, allowedSigners);
// Run verification command
auto [status, output] = runProgram(RunOptions{
auto [status, output] = runProgram(
RunOptions{
.program = "git",
.args =
{"-c",

View file

@ -56,7 +56,8 @@ Path getCachePath(std::string_view key, bool shallow)
// ...
std::optional<std::string> readHead(const Path & path)
{
auto [status, output] = runProgram(RunOptions{
auto [status, output] = runProgram(
RunOptions{
.program = "git",
// FIXME: use 'HEAD' to avoid returning all refs
.args = {"ls-remote", "--symref", path},
@ -325,7 +326,8 @@ struct GitInputScheme : InputScheme
writeFile(*repoPath / path.rel(), contents);
auto result = runProgram(RunOptions{
auto result = runProgram(
RunOptions{
.program = "git",
.args =
{"-C",

View file

@ -35,7 +35,8 @@ std::shared_ptr<Registry> Registry::read(const Settings & settings, const Path &
toAttrs.erase(j);
}
auto exact = i.find("exact");
registry->entries.push_back(Entry{
registry->entries.push_back(
Entry{
.from = Input::fromAttrs(settings, jsonToAttrs(i["from"])),
.to = Input::fromAttrs(settings, std::move(toAttrs)),
.extraAttrs = extraAttrs,

View file

@ -14,7 +14,8 @@ Gen<OutputsSpec> Arbitrary<OutputsSpec>::arbitrary()
return gen::just((OutputsSpec) OutputsSpec::All{});
case 1:
return gen::map(
gen::nonEmpty(gen::container<StringSet>(
gen::nonEmpty(
gen::container<StringSet>(
gen::map(gen::arbitrary<StorePathName>(), [](StorePathName n) { return n.name; }))),
[](StringSet names) { return (OutputsSpec) OutputsSpec::Names{names}; });
default:

View file

@ -82,13 +82,15 @@ VERSIONED_CHARACTERIZATION_TEST(
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
},
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{
.drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}),
.outputs = OutputsSpec::All{},
},
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{
.drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}),
.outputs = OutputsSpec::Names{"x", "y"},
@ -108,13 +110,15 @@ VERSIONED_CHARACTERIZATION_TEST(
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
},
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{
.drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}),
.outputs = OutputsSpec::All{},
},
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{
.drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}),
.outputs = OutputsSpec::Names{"x", "y"},
@ -369,7 +373,8 @@ VERSIONED_CHARACTERIZATION_TEST(WorkerProtoTest, keyedBuildResult_1_29, "keyed-b
},
/* .path = */
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{
.drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}),
.outputs = OutputsSpec::Names{"out"},

View file

@ -1456,7 +1456,8 @@ std::pair<bool, SingleDrvOutputs> DerivationGoal::checkPathValidity()
// derivation, and the output path is valid, but we don't have
// its realisation stored (probably because it has been built
// without the `ca-derivations` experimental flag).
worker.store.registerDrvOutput(Realisation{
worker.store.registerDrvOutput(
Realisation{
drvOutput,
info.known->path,
});
@ -1551,7 +1552,8 @@ void DerivationGoal::waiteeDone(GoalPtr waitee, ExitCode result)
auto & outputs = nodeP->value;
for (auto & outputName : outputs) {
auto buildResult = dg->getBuildResult(DerivedPath::Built{
auto buildResult = dg->getBuildResult(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(dg->drvPath),
.outputs = OutputsSpec::Names{outputName},
});

View file

@ -68,7 +68,8 @@ std::vector<KeyedBuildResult> Store::buildPathsWithResults(
results.reserve(state.size());
for (auto & [req, goalPtr] : state)
results.emplace_back(KeyedBuildResult{
results.emplace_back(
KeyedBuildResult{
goalPtr->getBuildResult(req),
/* .path = */ req,
});
@ -88,7 +89,8 @@ BuildResult Store::buildDerivation(const StorePath & drvPath, const BasicDerivat
try {
worker.run(Goals{goal});
return goal->getBuildResult(DerivedPath::Built{
return goal->getBuildResult(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(drvPath),
.outputs = OutputsSpec::All{},
});

View file

@ -279,7 +279,8 @@ void Worker::run(const Goals & _topGoals)
for (auto & i : _topGoals) {
topGoals.insert(i);
if (auto goal = dynamic_cast<DerivationGoal *>(i.get())) {
topPaths.push_back(DerivedPath::Built{
topPaths.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(goal->drvPath),
.outputs = goal->wantedOutputs,
});

View file

@ -39,7 +39,8 @@ LegacySSHStore::LegacySSHStore(std::string_view scheme, std::string_view host, c
, CommonSSHStoreConfig(scheme, host, params)
, LegacySSHStoreConfig(scheme, host, params)
, Store(params)
, connections(make_ref<Pool<Connection>>(
, connections(
make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections),
[this]() { return openConnection(); },
[](const ref<Connection> & r) { return r->good; }))

View file

@ -15,7 +15,8 @@ Machine::Machine(
decltype(supportedFeatures) supportedFeatures,
decltype(mandatoryFeatures) mandatoryFeatures,
decltype(sshPublicHostKey) sshPublicHostKey)
: storeUri(StoreReference::parse(
: storeUri(
StoreReference::parse(
// Backwards compatibility: if the URI is schemeless, is not a path,
// and is not one of the special store connection words, prepend
// ssh://.
@ -171,7 +172,8 @@ static Machine parseBuilderLine(const std::set<std::string> & defaultSystems, co
// TODO use designated initializers, once C++ supports those with
// custom constructors.
return {// `storeUri`
return {
// `storeUri`
tokens[0],
// `systemTypes`
isSet(1) ? tokenizeString<std::set<std::string>>(tokens[1], ",") : defaultSystems,

View file

@ -27,7 +27,8 @@ namespace nix {
RemoteStore::RemoteStore(const Params & params)
: RemoteStoreConfig(params)
, Store(params)
, connections(make_ref<Pool<Connection>>(
, connections(
make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections),
[this]() {
auto conn = openConnectionWrapper();
@ -655,7 +656,8 @@ std::vector<KeyedBuildResult> RemoteStore::buildPathsWithResults(
std::visit(
overloaded{
[&](const DerivedPath::Opaque & bo) {
results.push_back(KeyedBuildResult{
results.push_back(
KeyedBuildResult{
{
.status = BuildResult::Substituted,
},

View file

@ -93,8 +93,10 @@ static void initAWS()
S3Helper::S3Helper(
const std::string & profile, const std::string & region, const std::string & scheme, const std::string & endpoint)
: config(makeConfig(region, scheme, endpoint))
, client(make_ref<Aws::S3::S3Client>(
profile == "" ? std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>(
, client(
make_ref<Aws::S3::S3Client>(
profile == ""
? std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>(
std::make_shared<Aws::Auth::DefaultAWSCredentialsProviderChain>())
: std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>(
std::make_shared<Aws::Auth::ProfileConfigFileAWSCredentialsProvider>(profile.c_str())),

View file

@ -88,7 +88,8 @@ void handleDiffHook(
if (diffHookOpt && settings.runDiffHook) {
auto & diffHook = *diffHookOpt;
try {
auto diffRes = runProgram(RunOptions{
auto diffRes = runProgram(
RunOptions{
.program = diffHook,
.lookupPath = true,
.args = {tryA, tryB, drvPath, tmpDir},
@ -2715,7 +2716,8 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
std::filesystem::rename(tmpOutput, actualPath);
auto newInfo0 = newInfoFromCA(DerivationOutput::CAFloating{
auto newInfo0 = newInfoFromCA(
DerivationOutput::CAFloating{
.method = dof.ca.method,
.hashAlgo = wanted.algo,
});
@ -2754,7 +2756,8 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
},
[&](const DerivationOutput::Impure & doi) {
return newInfoFromCA(DerivationOutput::CAFloating{
return newInfoFromCA(
DerivationOutput::CAFloating{
.method = doi.method,
.hashAlgo = doi.hashAlgo,
});

View file

@ -314,7 +314,8 @@ TEST(Config, applyConfigFailsOnMissingIncludes)
Setting<std::string> setting{&config, "", "name-of-the-setting", "description"};
ASSERT_THROW(
config.applyConfig("name-of-the-setting = value-from-file\n"
config.applyConfig(
"name-of-the-setting = value-from-file\n"
"# name-of-the-setting = foo\n"
"include /nix/store/does/not/exist.nix"),
Error);

View file

@ -31,7 +31,8 @@ TEST(to_json, vectorOfOptionalInts)
TEST(to_json, optionalVectorOfInts)
{
std::optional<std::vector<int>> val = std::make_optional(std::vector<int>{
std::optional<std::vector<int>> val = std::make_optional(
std::vector<int>{
-420,
420,
});

View file

@ -41,7 +41,8 @@ Suggestions Suggestions::bestMatches(const std::set<std::string> & allMatches, s
{
std::set<Suggestion> res;
for (const auto & possibleMatch : allMatches) {
res.insert(Suggestion{
res.insert(
Suggestion{
.distance = levenshteinDistance(query, possibleMatch),
.suggestion = possibleMatch,
});

View file

@ -253,8 +253,13 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
std::string runProgram(
Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive)
{
auto res = runProgram(RunOptions{
.program = program, .lookupPath = lookupPath, .args = args, .input = input, .isInteractive = isInteractive});
auto res = runProgram(
RunOptions{
.program = program,
.lookupPath = lookupPath,
.args = args,
.input = input,
.isInteractive = isInteractive});
if (!statusOk(res.first))
throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first));

View file

@ -84,8 +84,13 @@ int Pid::wait()
std::string runProgram(
Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive)
{
auto res = runProgram(RunOptions{
.program = program, .lookupPath = lookupPath, .args = args, .input = input, .isInteractive = isInteractive});
auto res = runProgram(
RunOptions{
.program = program,
.lookupPath = lookupPath,
.args = args,
.input = input,
.isInteractive = isInteractive});
if (!statusOk(res.first))
throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first));

View file

@ -480,7 +480,8 @@ static void main_nix_build(int argc, char ** argv)
throw Error("the 'bashInteractive' attribute in <nixpkgs> did not evaluate to a derivation");
auto bashDrv = drv->requireDrvPath();
pathsToBuild.push_back(DerivedPath::Built{
pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(bashDrv),
.outputs = OutputsSpec::Names{"out"},
});
@ -499,7 +500,8 @@ static void main_nix_build(int argc, char ** argv)
accumDerivedPath = [&](ref<SingleDerivedPath> inputDrv,
const DerivedPathMap<StringSet>::ChildNode & inputNode) {
if (!inputNode.value.empty())
pathsToBuild.push_back(DerivedPath::Built{
pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = inputDrv,
.outputs = OutputsSpec::Names{inputNode.value},
});
@ -687,7 +689,8 @@ static void main_nix_build(int argc, char ** argv)
if (outputName == "")
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
pathsToBuild.push_back(DerivedPath::Built{
pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(drvPath),
.outputs = OutputsSpec::Names{outputName},
});

View file

@ -467,7 +467,8 @@ static void printMissing(EvalState & state, PackageInfos & elems)
};
targets.emplace_back(std::move(path));
} else
targets.emplace_back(DerivedPath::Opaque{
targets.emplace_back(
DerivedPath::Opaque{
.path = i.queryOutPath(),
});

View file

@ -70,7 +70,8 @@ UnresolvedApp InstallableValue::toApp(EvalState & state)
std::vector<DerivedPath> context2;
for (auto & c : context) {
context2.emplace_back(std::visit(
context2.emplace_back(
std::visit(
overloaded{
[&](const NixStringContextElem::DrvDeep & d) -> DerivedPath {
/* We want all outputs of the drv */

View file

@ -402,7 +402,8 @@ void mainWrapped(int argc, char ** argv)
self-aware. That is, it has to know where it is installed. We
don't think it's sentient.
*/
settings.buildHook.setDefault(Strings{
settings.buildHook.setDefault(
Strings{
getNixBin({}).string(),
"__build-remote",
});

View file

@ -15,7 +15,8 @@ void runNix(Path program, const Strings & args, const std::optional<std::string>
auto subprocessEnv = getEnv();
subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue();
// isInteractive avoid grabling interactive commands
runProgram2(RunOptions{
runProgram2(
RunOptions{
.program = getNixBin(program).string(),
.args = args,
.environment = subprocessEnv,

View file

@ -34,7 +34,8 @@ struct CmdSearch : InstallableValueCommand, MixJSON
CmdSearch()
{
expectArgs("regex", &res);
addFlag(Flag{
addFlag(
Flag{
.longName = "exclude",
.shortName = 'e',
.description = "Hide packages whose attribute path, name or description contain *regex*.",