Skip to content

Add missing temproots for cached sources and existing derivations#15237

Merged
xokdvium merged 1 commit intoNixOS:masterfrom
xokdvium:add-missing-temp-roots
Feb 16, 2026
Merged

Add missing temproots for cached sources and existing derivations#15237
xokdvium merged 1 commit intoNixOS:masterfrom
xokdvium:add-missing-temp-roots

Conversation

@xokdvium
Copy link
Contributor

Motivation

#15158 and #8417 (comment).

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the fetching Networking with the outside (non-Nix) world, input locking label Feb 14, 2026
@xokdvium
Copy link
Contributor Author

cc @lisanna-dettwyler, @domenkozar

@domenkozar
Copy link
Member

Thanks! I'll test it with our CI runners and cachix/devenv#2489 and report back

domenkozar added a commit to cachix/cachix-ci-agents that referenced this pull request Feb 14, 2026
Replace the fetchpatch-based overrideScope approach (which was a no-op
due to the wrapper package architecture) with a direct flake input
pinned to the PR commit that adds missing temproots for cached sources
and existing derivations.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@lisanna-dettwyler
Copy link
Contributor

In the case of a cached flake eval, fetchToStore will never even be called, so everything skips getting added to temproots. I'm not sure how to address that case though.

@xokdvium
Copy link
Contributor Author

In the case of a cached flake eval
I'm not sure how to address that case though.

Hm yeah, I'm not sure how to fix this too.

@xokdvium xokdvium added this pull request to the merge queue Feb 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 16, 2026
@xokdvium xokdvium added this pull request to the merge queue Feb 16, 2026
Merged via the queue into NixOS:master with commit 46a4a55 Feb 16, 2026
14 checks passed
@xokdvium xokdvium deleted the add-missing-temp-roots branch February 16, 2026 20:21
@lisanna-dettwyler
Copy link
Contributor

lisanna-dettwyler commented Feb 17, 2026

In the case of a cached flake eval
I'm not sure how to address that case though.

Hm yeah, I'm not sure how to fix this too.

@xokdvium I am not too familiar with the flake code, but could it be as simple as:

diff --git a/src/libflake/flake.cc b/src/libflake/flake.cc
index 9dab20c5c..f39b88233 100644
--- a/src/libflake/flake.cc
+++ b/src/libflake/flake.cc
@@ -1026,6 +1026,8 @@ ref<eval_cache::EvalCache> openEvalCache(EvalState & state, ref<const LockedFlak
     };
 
     if (fingerprint) {
+        for (auto & [_, sourcePath] : lockedFlake->nodePaths)
+            state.store->addTempRoot(state.store->toStorePath(sourcePath.path.abs()).first);
         auto search = state.evalCaches.find(fingerprint.value());
         if (search == state.evalCaches.end()) {
             search = state.evalCaches

Edit: I can't reproduce the behavior I was seeing before where fetchToStore isn't called in the case of cached flake eval, now I see it always being called, so this PR may be sufficient.

@bjornfor
Copy link
Contributor

Does this PR fix #2285?

@xokdvium
Copy link
Contributor Author

Does this PR fix #2285?

Hopefully, I don't think there are any more obvious issues. Let's wait to hear from @domenkozar for their experience in CI agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants