Add comments

This commit is contained in:
Eelco Dolstra 2019-06-04 21:07:55 +02:00
parent 4d31cf83f2
commit 087530dec4
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -314,6 +314,15 @@ bool allowedToUseRegistries(HandleLockFile handle, bool isTopRef)
else assert(false); 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( static std::pair<Flake, FlakeInput> updateLocks(
EvalState & state, EvalState & state,
const FlakeRef & flakeRef, const FlakeRef & flakeRef,
@ -360,9 +369,8 @@ static std::pair<Flake, FlakeInput> updateLocks(
return {flake, newEntry}; return {flake, newEntry};
} }
/* Given a flake reference, recursively fetch it and its dependencies. /* Compute an in-memory lockfile for the specified top-level flake,
FIXME: this should return a graph of flakes. and optionally write it to file, it the flake is writable. */
*/
ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLockFile handleLockFile) ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLockFile handleLockFile)
{ {
auto flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true)); auto flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true));