mirror of
https://github.com/NixOS/nix.git
synced 2025-11-25 19:51:00 +01:00
Apply clang-format universally.
* It is tough to contribute to a project that doesn't use a formatter, * It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files * Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose, Let's rip the bandaid off? Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.
This commit is contained in:
parent
41bf87ec70
commit
e4f62e4608
587 changed files with 23258 additions and 23135 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
|
||||
PackageInfos queryInstalled(EvalState & state, const Path & userEnv)
|
||||
{
|
||||
PackageInfos elems;
|
||||
|
|
@ -31,10 +30,8 @@ PackageInfos queryInstalled(EvalState & state, const Path & userEnv)
|
|||
return elems;
|
||||
}
|
||||
|
||||
|
||||
bool createUserEnv(EvalState & state, PackageInfos & elems,
|
||||
const Path & profile, bool keepDerivations,
|
||||
const std::string & lockToken)
|
||||
bool createUserEnv(
|
||||
EvalState & state, PackageInfos & elems, const Path & profile, bool keepDerivations, const std::string & lockToken)
|
||||
{
|
||||
/* Build the components in the user environment, if they don't
|
||||
exist already. */
|
||||
|
|
@ -44,9 +41,7 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
drvsToBuild.push_back({*drvPath});
|
||||
|
||||
debug("building user environment dependencies");
|
||||
state.store->buildPaths(
|
||||
toDerivedPaths(drvsToBuild),
|
||||
state.repair ? bmRepair : bmNormal);
|
||||
state.store->buildPaths(toDerivedPaths(drvsToBuild), state.repair ? bmRepair : bmNormal);
|
||||
|
||||
/* Construct the whole top level derivation. */
|
||||
StorePathSet references;
|
||||
|
|
@ -91,7 +86,8 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
auto meta = state.buildBindings(metaNames.size());
|
||||
for (auto & j : metaNames) {
|
||||
Value * v = i.queryMeta(j);
|
||||
if (!v) continue;
|
||||
if (!v)
|
||||
continue;
|
||||
meta.insert(state.symbols.create(j), v);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +95,8 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
|
||||
(list[n] = state.allocValue())->mkAttrs(attrs);
|
||||
|
||||
if (drvPath) references.insert(*drvPath);
|
||||
if (drvPath)
|
||||
references.insert(*drvPath);
|
||||
}
|
||||
|
||||
Value manifest;
|
||||
|
|
@ -111,16 +108,23 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
auto manifestFile = ({
|
||||
std::ostringstream str;
|
||||
printAmbiguous(manifest, state.symbols, str, nullptr, std::numeric_limits<int>::max());
|
||||
StringSource source { toView(str) };
|
||||
StringSource source{toView(str)};
|
||||
state.store->addToStoreFromDump(
|
||||
source, "env-manifest.nix", FileSerialisationMethod::Flat, ContentAddressMethod::Raw::Text, HashAlgorithm::SHA256, references);
|
||||
source,
|
||||
"env-manifest.nix",
|
||||
FileSerialisationMethod::Flat,
|
||||
ContentAddressMethod::Raw::Text,
|
||||
HashAlgorithm::SHA256,
|
||||
references);
|
||||
});
|
||||
|
||||
/* Get the environment builder expression. */
|
||||
Value envBuilder;
|
||||
state.eval(state.parseExprFromString(
|
||||
#include "buildenv.nix.gen.hh"
|
||||
, state.rootPath(CanonPath::root)), envBuilder);
|
||||
state.eval(
|
||||
state.parseExprFromString(
|
||||
#include "buildenv.nix.gen.hh"
|
||||
, state.rootPath(CanonPath::root)),
|
||||
envBuilder);
|
||||
|
||||
/* Construct a Nix expression that calls the user environment
|
||||
builder with the manifest as argument. */
|
||||
|
|
@ -147,9 +151,7 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
debug("building user environment");
|
||||
std::vector<StorePathWithOutputs> topLevelDrvs;
|
||||
topLevelDrvs.push_back({topLevelDrv});
|
||||
state.store->buildPaths(
|
||||
toDerivedPaths(topLevelDrvs),
|
||||
state.repair ? bmRepair : bmNormal);
|
||||
state.store->buildPaths(toDerivedPaths(topLevelDrvs), state.repair ? bmRepair : bmNormal);
|
||||
|
||||
/* Switch the current user environment to the output path. */
|
||||
auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>();
|
||||
|
|
@ -172,5 +174,4 @@ bool createUserEnv(EvalState & state, PackageInfos & elems,
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ namespace nix {
|
|||
|
||||
PackageInfos queryInstalled(EvalState & state, const Path & userEnv);
|
||||
|
||||
bool createUserEnv(EvalState & state, PackageInfos & elems,
|
||||
const Path & profile, bool keepDerivations,
|
||||
const std::string & lockToken);
|
||||
bool createUserEnv(
|
||||
EvalState & state, PackageInfos & elems, const Path & profile, bool keepDerivations, const std::string & lockToken);
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue