From 15ec2c466356b3267abe0fd993b5d8992c73381f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 12 Sep 2023 09:01:51 +0200 Subject: [PATCH] print derivation name if system attribute is missing --- src/nix-eval-jobs.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 75cda14..8acdc64 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -96,13 +96,13 @@ struct MyArgs : MixEvalArgs, MixCommonArgs { .handler = { [=, this](std::string s) { nrWorkers = std::stoi(s); }}}); - addFlag( - {.longName = "max-memory-size", - .description = - "maximum evaluation memory size (4GiB per worker by default)", - .labels = {"size"}, - .handler = { - [=, this](std::string s) { maxMemorySize = std::stoi(s); }}}); + addFlag({.longName = "max-memory-size", + .description = "maximum evaluation memory size in megabyte " + "(4GiB per worker by default)", + .labels = {"size"}, + .handler = {[=, this](std::string s) { + maxMemorySize = std::stoi(s); + }}}); addFlag({.longName = "flake", .description = "build a flake", @@ -201,8 +201,11 @@ struct Drv { std::optional meta; Drv(EvalState &state, DrvInfo &drvInfo) { - if (drvInfo.querySystem() == "unknown") - throw EvalError("derivation must have a 'system' attribute"); + name = drvInfo.queryName(); + system = drvInfo.querySystem(); + if (system == "unknown") + throw EvalError("derivation '" + name + + "' must have a 'system' attribute"); auto localStore = state.store.dynamic_pointer_cast(); @@ -239,8 +242,6 @@ struct Drv { isCached = queryIsCached(*localStore, outputs); } - name = drvInfo.queryName(); - system = drvInfo.querySystem(); drvPath = localStore->printStorePath(drvInfo.requireDrvPath()); auto drv = localStore->readDerivation(drvInfo.requireDrvPath());