diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index b6614b0..8ee192a 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -171,10 +171,13 @@ static void worker( throw EvalError("derivation must have a 'system' attribute"); auto drvPath = drv->queryDrvPath(); + auto localStore = state.store.dynamic_pointer_cast(); + auto storePath = localStore->parseStorePath(drvPath); reply["name"] = drv->queryName(); reply["system"] = drv->querySystem(); reply["drvPath"] = drvPath; + reply["storePath"] = localStore->printStorePath(storePath); nlohmann::json meta; for (auto & name : drv->queryMetaNames()) { @@ -196,9 +199,7 @@ static void worker( /* Register the derivation as a GC root. !!! This registers roots for jobs that we may have already done. */ - auto localStore = state.store.dynamic_pointer_cast(); - auto storePath = localStore->parseStorePath(drvPath); - if (gcRootsDir != "" && localStore) { + if (gcRootsDir != "") { Path root = gcRootsDir + "/" + std::string(baseNameOf(drvPath)); if (!pathExists(root)) localStore->addPermRoot(storePath, root); diff --git a/tests/test_eval.py b/tests/test_eval.py index 32a31e7..404985c 100644 --- a/tests/test_eval.py +++ b/tests/test_eval.py @@ -28,6 +28,8 @@ def common_test(extra_args: List[str]) -> None: built_job = results[0] assert built_job["attr"] == "builtJob" assert built_job["name"] == "job1" + assert built_job["storePath"].startswith("/nix/store") + assert built_job["drvPath"].endswith(".drv") substituted_job = results[1]