Skip to content

Commit 842b884

Browse files
authored
Merge pull request #131 from DeterminateSystems/path-fingerprint
Fix eval caching for path flakes
2 parents 7bb167d + 38a7320 commit 842b884

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/libfetchers/fetchers.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
354354

355355
if (!accessor->fingerprint)
356356
accessor->fingerprint = result.getFingerprint(store);
357+
else
358+
result.cachedFingerprint = accessor->fingerprint;
357359

358360
return {accessor, std::move(result)};
359361
}

src/libfetchers/path.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ struct PathInputScheme : InputScheme
127127

128128
auto absPath = getAbsPath(input);
129129

130-
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying %s to the store", absPath));
131-
132130
// FIXME: check whether access to 'path' is allowed.
133131
auto storePath = store->maybeParseStorePath(absPath.string());
134132

@@ -137,6 +135,7 @@ struct PathInputScheme : InputScheme
137135

138136
time_t mtime = 0;
139137
if (!storePath || storePath->name() != "source" || !store->isValidPath(*storePath)) {
138+
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying %s to the store", absPath));
140139
// FIXME: try to substitute storePath.
141140
auto src = sinkToSource([&](Sink & sink) {
142141
mtime = dumpPathAndGetMtime(absPath.string(), sink, defaultPathFilter);

tests/functional/flakes/flakes.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ nix build -o $TEST_ROOT/result git+file://$flakeGitBare
374374
mkdir -p $flake5Dir
375375
writeDependentFlake $flake5Dir
376376
nix flake lock path://$flake5Dir
377+
[[ "$(nix flake metadata path://$flake5Dir --json | jq -r .fingerprint)" != null ]]
377378

378379
# Test tarball flakes.
379380
tar cfz $TEST_ROOT/flake.tar.gz -C $TEST_ROOT flake5

0 commit comments

Comments
 (0)