aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops/flake.cc46
-rw-r--r--src/libexpr/primops/flake.hh8
-rw-r--r--src/nix/flake.cc14
3 files changed, 34 insertions, 34 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc
index 720e157c6..c098168de 100644
--- a/src/libexpr/primops/flake.cc
+++ b/src/libexpr/primops/flake.cc
@@ -351,7 +351,7 @@ NonFlake getNonFlake(EvalState & state, const FlakeRef & flakeRef, FlakeAlias al
dependencies.
FIXME: this should return a graph of flakes.
*/
-Dependencies resolveFlake(EvalState & state, const FlakeRef & topRef,
+ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef,
RegistryAccess registryAccess, bool isTopFlake)
{
Flake flake = getFlake(state, topRef,
@@ -362,7 +362,7 @@ Dependencies resolveFlake(EvalState & state, const FlakeRef & topRef,
if (isTopFlake)
lockFile = readLockFile(flake.sourceInfo.storePath + "/flake.lock"); // FIXME: symlink attack
- Dependencies deps(flake);
+ ResolvedFlake deps(flake);
for (auto & nonFlakeInfo : flake.nonFlakeRequires)
deps.nonFlakeDeps.push_back(getNonFlake(state, nonFlakeInfo.second, nonFlakeInfo.first));
@@ -377,14 +377,14 @@ Dependencies resolveFlake(EvalState & state, const FlakeRef & topRef,
return deps;
}
-LockFile::FlakeEntry dependenciesToFlakeEntry(const Dependencies & deps)
+LockFile::FlakeEntry dependenciesToFlakeEntry(const ResolvedFlake & resolvedFlake)
{
- LockFile::FlakeEntry entry(deps.flake.sourceInfo.flakeRef);
+ LockFile::FlakeEntry entry(resolvedFlake.flake.sourceInfo.flakeRef);
- for (auto & deps : deps.flakeDeps)
- entry.flakeEntries.insert_or_assign(deps.flake.id, dependenciesToFlakeEntry(deps));
+ for (auto & newResFlake : resolvedFlake.flakeDeps)
+ entry.flakeEntries.insert_or_assign(newResFlake.flake.id, dependenciesToFlakeEntry(newResFlake));
- for (auto & nonFlake : deps.nonFlakeDeps)
+ for (auto & nonFlake : resolvedFlake.nonFlakeDeps)
entry.nonFlakeEntries.insert_or_assign(nonFlake.alias, nonFlake.ref);
return entry;
@@ -392,8 +392,8 @@ LockFile::FlakeEntry dependenciesToFlakeEntry(const Dependencies & deps)
static LockFile makeLockFile(EvalState & evalState, FlakeRef & flakeRef)
{
- Dependencies deps = resolveFlake(evalState, flakeRef, AllowRegistry);
- LockFile::FlakeEntry entry = dependenciesToFlakeEntry(deps);
+ ResolvedFlake resFlake = resolveFlake(evalState, flakeRef, AllowRegistry);
+ LockFile::FlakeEntry entry = dependenciesToFlakeEntry(resFlake);
LockFile lockFile;
lockFile.flakeEntries = entry.flakeEntries;
lockFile.nonFlakeEntries = entry.nonFlakeEntries;
@@ -414,37 +414,37 @@ void updateLockFile(EvalState & state, const Path & path)
runProgram("git", true, { "-C", path, "add", "flake.lock" });
}
-void callFlake(EvalState & state, const Dependencies & flake, Value & v)
+void callFlake(EvalState & state, const ResolvedFlake & resFlake, Value & v)
{
// Construct the resulting attrset '{description, provides,
// ...}'. This attrset is passed lazily as an argument to 'provides'.
- state.mkAttrs(v, flake.flakeDeps.size() + flake.nonFlakeDeps.size() + 8);
+ state.mkAttrs(v, resFlake.flakeDeps.size() + resFlake.nonFlakeDeps.size() + 8);
- for (auto & dep : flake.flakeDeps) {
- auto vFlake = state.allocAttr(v, dep.flake.id);
- callFlake(state, dep, *vFlake);
+ for (const ResolvedFlake newResFlake : resFlake.flakeDeps) {
+ auto vFlake = state.allocAttr(v, newResFlake.flake.id);
+ callFlake(state, newResFlake, *vFlake);
}
- for (auto & dep : flake.nonFlakeDeps) {
- auto vNonFlake = state.allocAttr(v, dep.alias);
+ for (const NonFlake nonFlake : resFlake.nonFlakeDeps) {
+ auto vNonFlake = state.allocAttr(v, nonFlake.alias);
state.mkAttrs(*vNonFlake, 4);
- state.store->isValidPath(dep.path);
- mkString(*state.allocAttr(*vNonFlake, state.sOutPath), dep.path, {dep.path});
+ state.store->isValidPath(nonFlake.path);
+ mkString(*state.allocAttr(*vNonFlake, state.sOutPath), nonFlake.path, {nonFlake.path});
}
- mkString(*state.allocAttr(v, state.sDescription), flake.flake.description);
+ mkString(*state.allocAttr(v, state.sDescription), resFlake.flake.description);
- auto & path = flake.flake.sourceInfo.storePath;
+ auto & path = resFlake.flake.sourceInfo.storePath;
state.store->isValidPath(path);
mkString(*state.allocAttr(v, state.sOutPath), path, {path});
- if (flake.flake.sourceInfo.revCount)
- mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *flake.flake.sourceInfo.revCount);
+ if (resFlake.flake.sourceInfo.revCount)
+ mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *resFlake.flake.sourceInfo.revCount);
auto vProvides = state.allocAttr(v, state.symbols.create("provides"));
- mkApp(*vProvides, *flake.flake.vProvides, v);
+ mkApp(*vProvides, *resFlake.flake.vProvides, v);
v.attrs->push_back(Attr(state.symbols.create("self"), &v));
diff --git a/src/libexpr/primops/flake.hh b/src/libexpr/primops/flake.hh
index 85f4fdf9f..0b70088cc 100644
--- a/src/libexpr/primops/flake.hh
+++ b/src/libexpr/primops/flake.hh
@@ -74,15 +74,15 @@ std::shared_ptr<FlakeRegistry> getGlobalRegistry();
Flake getFlake(EvalState &, const FlakeRef &, bool impureIsAllowed);
-struct Dependencies
+struct ResolvedFlake
{
Flake flake;
- std::vector<Dependencies> flakeDeps; // The flake dependencies
+ std::vector<ResolvedFlake> flakeDeps; // The flake dependencies
std::vector<NonFlake> nonFlakeDeps;
- Dependencies(const Flake & flake) : flake(flake) {}
+ ResolvedFlake(const Flake & flake) : flake(flake) {}
};
-Dependencies resolveFlake(EvalState &, const FlakeRef &, RegistryAccess registryAccess, bool isTopFlake = true);
+ResolvedFlake resolveFlake(EvalState &, const FlakeRef &, RegistryAccess registryAccess, bool isTopFlake = true);
void updateLockFile(EvalState &, const Path & path);
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index eec280584..acba912e5 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -90,20 +90,20 @@ struct CmdFlakeDeps : FlakeCommand, MixJSON, StoreCommand, MixEvalArgs
FlakeRef flakeRef(flakeUri);
- Dependencies deps = resolveFlake(*evalState, flakeRef, AllowRegistryAtTop);
+ ResolvedFlake resFlake = resolveFlake(*evalState, flakeRef, AllowRegistryAtTop);
- std::queue<Dependencies> todo;
- todo.push(deps);
+ std::queue<ResolvedFlake> todo;
+ todo.push(resFlake);
while (!todo.empty()) {
- deps = todo.front();
+ resFlake = todo.front();
todo.pop();
- for (auto & nonFlake : deps.nonFlakeDeps)
+ for (NonFlake & nonFlake : resFlake.nonFlakeDeps)
printNonFlakeInfo(nonFlake, json);
- for (auto & newDeps : deps.flakeDeps)
- todo.push(newDeps);
+ for (ResolvedFlake & newResFlake : resFlake.flakeDeps)
+ todo.push(newResFlake);
}
}
};