From 51acb1d4bc5ac16a593dc171e8debedd5ffe7f73 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 27 Jun 2025 17:59:15 +0200 Subject: [PATCH 1/2] Path fetcher: Only show "copying to store" when actually copying --- src/libfetchers/path.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc index 0de81ae43..c199957eb 100644 --- a/src/libfetchers/path.cc +++ b/src/libfetchers/path.cc @@ -127,8 +127,6 @@ struct PathInputScheme : InputScheme auto absPath = getAbsPath(input); - Activity act(*logger, lvlTalkative, actUnknown, fmt("copying %s to the store", absPath)); - // FIXME: check whether access to 'path' is allowed. auto storePath = store->maybeParseStorePath(absPath.string()); @@ -137,6 +135,7 @@ struct PathInputScheme : InputScheme time_t mtime = 0; if (!storePath || storePath->name() != "source" || !store->isValidPath(*storePath)) { + Activity act(*logger, lvlTalkative, actUnknown, fmt("copying %s to the store", absPath)); // FIXME: try to substitute storePath. auto src = sinkToSource([&](Sink & sink) { mtime = dumpPathAndGetMtime(absPath.string(), sink, defaultPathFilter); From 38a73203a4b304cb0987d4b32a17f7d2137575a4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 27 Jun 2025 20:02:18 +0200 Subject: [PATCH 2/2] Fix eval caching for path flakes This fix is somewhat hacky since the accessor/input fingerprint situation is a bit of a mess. --- src/libfetchers/fetchers.cc | 2 ++ tests/functional/flakes/flakes.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index d91f24b6a..4d2d66a72 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -354,6 +354,8 @@ std::pair, Input> Input::getAccessorUnchecked(ref sto if (!accessor->fingerprint) accessor->fingerprint = result.getFingerprint(store); + else + result.cachedFingerprint = accessor->fingerprint; return {accessor, std::move(result)}; } diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index ec5cc9c53..cfd204569 100755 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -374,6 +374,7 @@ nix build -o $TEST_ROOT/result git+file://$flakeGitBare mkdir -p $flake5Dir writeDependentFlake $flake5Dir nix flake lock path://$flake5Dir +[[ "$(nix flake metadata path://$flake5Dir --json | jq -r .fingerprint)" != null ]] # Test tarball flakes. tar cfz $TEST_ROOT/flake.tar.gz -C $TEST_ROOT flake5