From 26948992b3d64309e7946014301778b3c7dbbdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 31 Dec 2021 12:00:04 +0100 Subject: [PATCH] also expose store path in json --- src/nix-eval-jobs.cc | 7 ++++--- tests/test_eval.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) 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]