mirror of
https://github.com/NixOS/nix.git
synced 2025-12-08 01:51:01 +01:00
Store DerivationOption instead Derivation, put in JSON format
This opens the door to derivations that *directly* specify their options, rather than "stealing" environment variables to do so. The A-Term derivation format used on disk didn't change --- we cannot do that for existing derivations, so those derivations will continue to not support separate options. But having a more flexible JSON format opens the door to extending the on-disk format in others, like directly using JSON, using CBOR, etc. Co-authored-by: HaeNoe <git@haenoe.party> Co-authored-by: Jonathan Gibbons <jonored@gmail.com>
This commit is contained in:
parent
00d2bf91b2
commit
a9fdd537ac
28 changed files with 514 additions and 104 deletions
|
|
@ -224,18 +224,8 @@ MissingPaths Store::queryMissing(const std::vector<DerivedPath> & targets)
|
|||
return;
|
||||
|
||||
auto drv = make_ref<Derivation>(derivationFromPath(drvPath));
|
||||
DerivationOptions<SingleDerivedPath> drvOptions;
|
||||
try {
|
||||
// FIXME: this is a lot of work just to get the value
|
||||
// of `allowSubstitutes`.
|
||||
drvOptions =
|
||||
derivationOptionsFromStructuredAttrs(*this, drv->inputDrvs, drv->env, drv->structuredAttrs);
|
||||
} catch (Error & e) {
|
||||
e.addTrace({}, "while parsing derivation '%s'", printStorePath(drvPath));
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!knownOutputPaths && settings.useSubstitutes && drvOptions.substitutesAllowed()) {
|
||||
if (!knownOutputPaths && settings.useSubstitutes && drv->options.substitutesAllowed()) {
|
||||
experimentalFeatureSettings.require(Xp::CaDerivations);
|
||||
|
||||
// If there are unknown output paths, attempt to find if the
|
||||
|
|
@ -265,7 +255,7 @@ MissingPaths Store::queryMissing(const std::vector<DerivedPath> & targets)
|
|||
}
|
||||
}
|
||||
|
||||
if (knownOutputPaths && settings.useSubstitutes && drvOptions.substitutesAllowed()) {
|
||||
if (knownOutputPaths && settings.useSubstitutes && drv->options.substitutesAllowed()) {
|
||||
auto drvState = make_ref<Sync<DrvState>>(DrvState(invalid.size()));
|
||||
for (auto & output : invalid)
|
||||
pool.enqueue(std::bind(checkOutput, drvPath, drv, output, drvState));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue