1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-09 07:53:55 +02:00

ParsedDerivation: don't take drvPath

It is just use for adding context to errors, but we have `addTrace` to
do that. Let the callers do that instead.

The callers doing so is a bit duplicated, yes, but this will get better
once `DerivationOptions` is included in `Derivation`.
This commit is contained in:
John Ericson 2025-02-03 10:28:39 -05:00
parent 71567373b6
commit 0123640009
6 changed files with 35 additions and 19 deletions

View file

@ -544,8 +544,14 @@ static void main_nix_build(int argc, char * * argv)
env["NIX_STORE"] = store->storeDir;
env["NIX_BUILD_CORES"] = std::to_string(settings.buildCores);
ParsedDerivation parsedDrv(packageInfo.requireDrvPath(), drv);
DerivationOptions drvOptions = DerivationOptions::fromParsedDerivation(parsedDrv);
ParsedDerivation parsedDrv(drv);
DerivationOptions drvOptions;
try {
drvOptions = DerivationOptions::fromParsedDerivation(parsedDrv);
} catch (Error & e) {
e.addTrace({}, "while parsing derivation '%s'", store->printStorePath(packageInfo.requireDrvPath()));
throw;
}
int fileNr = 0;