diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-01-22 20:59:59 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-01-22 20:59:59 +0100 |
commit | 872a22fa2344bdb95e0697bca168d6798d60ff5d (patch) | |
tree | 9d7320564423fd55300ec1ba2c9d159859923a78 /src/libexpr/flake | |
parent | b5c9dbc84f31a1e9d1e5b6642b1716daa13c18ed (diff) |
resolveFlake -> lockFlake
"resolve" is ambiguous (also used for registry resolution).
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r-- | src/libexpr/flake/flake.cc | 20 | ||||
-rw-r--r-- | src/libexpr/flake/flake.hh | 8 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 250eab3bc..a0036c7bd 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -302,7 +302,10 @@ static std::pair<Flake, LockedInput> updateLocks( /* 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) +LockedFlake lockFlake( + EvalState & state, + const FlakeRef & topRef, + HandleLockFile handleLockFile) { settings.requireExperimentalFeature("flakes"); @@ -356,12 +359,7 @@ ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLoc warn("using updated lock file without writing it to file"); } - return ResolvedFlake { .flake = std::move(flake), .lockFile = std::move(lockFile) }; -} - -void updateLockFile(EvalState & state, const FlakeRef & flakeRef, bool recreateLockFile) -{ - resolveFlake(state, flakeRef, recreateLockFile ? RecreateLockFile : UpdateLockFile); + return LockedFlake { .flake = std::move(flake), .lockFile = std::move(lockFile) }; } static void emitSourceInfoAttrs(EvalState & state, const fetchers::Tree & sourceInfo, Value & vAttrs) @@ -480,16 +478,16 @@ void callFlake(EvalState & state, } void callFlake(EvalState & state, - const ResolvedFlake & resFlake, + const LockedFlake & lockedFlake, Value & v) { - callFlake(state, resFlake.flake, resFlake.lockFile, v); + callFlake(state, lockedFlake.flake, lockedFlake.lockFile, v); } // This function is exposed to be used in nix files. static void prim_getFlake(EvalState & state, const Pos & pos, Value * * args, Value & v) { - callFlake(state, resolveFlake(state, parseFlakeRef(state.forceStringNoCtx(*args[0], pos)), + callFlake(state, lockFlake(state, parseFlakeRef(state.forceStringNoCtx(*args[0], pos)), evalSettings.pureEval ? AllPure : UseUpdatedLockFile), v); } @@ -497,7 +495,7 @@ static RegisterPrimOp r2("getFlake", 1, prim_getFlake); } -Fingerprint ResolvedFlake::getFingerprint() const +Fingerprint LockedFlake::getFingerprint() const { // FIXME: as an optimization, if the flake contains a lock file // and we haven't changed it, then it's sufficient to use diff --git a/src/libexpr/flake/flake.hh b/src/libexpr/flake/flake.hh index afd49436b..a9864c5e8 100644 --- a/src/libexpr/flake/flake.hh +++ b/src/libexpr/flake/flake.hh @@ -46,7 +46,7 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef, bool allowLookup); /* Fingerprint of a locked flake; used as a cache key. */ typedef Hash Fingerprint; -struct ResolvedFlake +struct LockedFlake { Flake flake; LockFile lockFile; @@ -54,7 +54,7 @@ struct ResolvedFlake Fingerprint getFingerprint() const; }; -ResolvedFlake resolveFlake(EvalState &, const FlakeRef &, HandleLockFile); +LockedFlake lockFlake(EvalState &, const FlakeRef &, HandleLockFile); void callFlake(EvalState & state, const Flake & flake, @@ -62,11 +62,9 @@ void callFlake(EvalState & state, Value & v); void callFlake(EvalState & state, - const ResolvedFlake & resFlake, + const LockedFlake & resFlake, Value & v); -void updateLockFile(EvalState &, const FlakeRef & flakeRef, bool recreateLockFile); - } } |