diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 15:46:30 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 15:46:30 +0100 |
commit | 86748d357168ab37a4412d03c1f9ee99951843f5 (patch) | |
tree | aaf363bd8526a0427ba9bd46864a82ab48be4fd5 /src/libexpr | |
parent | af35b318f3312ba8147fe2d44eef71ad7924939e (diff) |
Re-read flake after updating flake.lock
Otherwise we'll evaluate the flake with the wrong metadata (rev, ...).
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/flake/flake.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index e3fb02591..39fdc776c 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -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. |