aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-04 21:07:55 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-04 21:07:55 +0200
commit087530dec40bd5ab23fe2da83fca517bb91d2282 (patch)
tree76ae9e6536f43cc2a355835aad6be00b2866dd5d /src/libexpr/primops
parent4d31cf83f288ed2e4a14f72e99b77859de981bb4 (diff)
Add comments
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/flake.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc
index f99738db5..000a43764 100644
--- a/src/libexpr/primops/flake.cc
+++ b/src/libexpr/primops/flake.cc
@@ -314,6 +314,15 @@ bool allowedToUseRegistries(HandleLockFile handle, bool isTopRef)
else assert(false);
}
+/* Given a flakeref and its subtree of the lockfile, return an updated
+ subtree of the lockfile. That is, if the 'flake.nix' of the
+ referenced flake has inputs that don't have a corresponding entry
+ in the lockfile, they're added to the lockfile; conversely, any
+ lockfile entries that don't have a corresponding entry in flake.nix
+ are removed.
+
+ Note that this is lazy: we only recursively fetch inputs that are
+ not in the lockfile yet. */
static std::pair<Flake, FlakeInput> updateLocks(
EvalState & state,
const FlakeRef & flakeRef,
@@ -360,9 +369,8 @@ static std::pair<Flake, FlakeInput> updateLocks(
return {flake, newEntry};
}
-/* Given a flake reference, recursively fetch it and its dependencies.
- FIXME: this should return a graph of flakes.
-*/
+/* Compute an in-memory lockfile for the specified top-level flake,
+ and optionally write it to file, it the flake is writable. */
ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLockFile handleLockFile)
{
auto flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true));