From 7aa9835adb0ff1713fd4a6bf2fff7dcd90e3371e Mon Sep 17 00:00:00 2001 From: John Soo Date: Thu, 21 Apr 2022 11:22:29 -0700 Subject: [PATCH] Cleanup gcroots creation. --- src/nix-eval-jobs.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 6eb2751..3f43d84 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -264,8 +264,6 @@ static void worker( if (auto drvInfo = getDerivation(state, *v, false)) { auto drv = Drv(state, *drvInfo); - auto localStore = state.store.dynamic_pointer_cast(); - auto storePath = localStore->parseStorePath(drv.drvPath); reply = drv; reply["attr"] = attrPath; @@ -275,8 +273,11 @@ static void worker( done. */ if (myArgs.gcRootsDir != "") { Path root = myArgs.gcRootsDir + "/" + std::string(baseNameOf(drv.drvPath)); - if (!pathExists(root)) + if (!pathExists(root)) { + auto localStore = state.store.dynamic_pointer_cast(); + auto storePath = localStore->parseStorePath(drv.drvPath); localStore->addPermRoot(storePath, root); + } } }