1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 00:12:43 +01:00

Perform input rewrites only in LocalDerivationGoal

This commit is contained in:
Maximilian Bosch 2021-06-24 15:06:07 +02:00
parent 6f206549ba
commit 644415d391
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
4 changed files with 14 additions and 12 deletions

View file

@ -124,7 +124,7 @@ bool ParsedDerivation::substitutesAllowed() const
}
static std::regex shVarName("[A-Za-z_][A-Za-z0-9_]*");
std::optional<nlohmann::json> ParsedDerivation::prepareStructuredAttrs(std::optional<StringMap> inputRewrites, Store & store, const StorePathSet & inputPaths)
std::optional<nlohmann::json> ParsedDerivation::prepareStructuredAttrs(Store & store, const StorePathSet & inputPaths)
{
auto structuredAttrs = getStructuredAttrs();
if (!structuredAttrs) return std::nullopt;
@ -134,14 +134,7 @@ std::optional<nlohmann::json> ParsedDerivation::prepareStructuredAttrs(std::opti
/* Add an "outputs" object containing the output paths. */
nlohmann::json outputs;
for (auto & i : drv.outputs) {
if (inputRewrites) {
/* The placeholder must have a rewrite, so we use it to cover both the
cases where we know or don't know the output path ahead of time. */
outputs[i.first] = rewriteStrings(hashPlaceholder(i.first), inputRewrites.value());
} else {
/* This case is only relevant for the nix-shell */
outputs[i.first] = hashPlaceholder(i.first);
}
outputs[i.first] = hashPlaceholder(i.first);
}
json["outputs"] = outputs;