Re-read flake after updating flake.lock

Otherwise we'll evaluate the flake with the wrong metadata (rev, ...).
This commit is contained in:
Eelco Dolstra 2020-02-02 15:46:30 +01:00
parent af35b318f3
commit 86748d3571
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -579,8 +579,13 @@ LockedFlake lockFlake(
newLockFile.write(path);
// FIXME: rewriting the lockfile changed the
// top-level repo, so we should re-read it.
// Rewriting the lockfile changed the top-level
// repo, so we should re-read it.
FlakeCache dummyCache;
flake = getFlake(state, topRef, {}, lockFlags.useRegistries, dummyCache);
if (flake.lockedRef.input->isImmutable())
throw Error("'%s' did not change after I updated its 'flake.lock' file; is 'flake.lock' under version control?", flake.originalRef);
#if 0
// Hack: Make sure that flake.lock is visible to Git, so it ends up in the Nix store.