Don't use read-only mode for nix build --dry-run
In dry run mode, new derivations can't be create, so running the command on anything that has not been evaluated before results in an error message of the form `don't know how to build these paths (may be caused by read-only store access)`. For comparison, the classical `nix-build --dry-run` doesn't use read-only mode. Closes #1795 (cherry picked from commit 54525682df707742e58311c32e9c9cb18de1e31f)
This commit is contained in:
parent
b2e8120d25
commit
bc6e7ca046
|
@ -756,7 +756,7 @@ BuiltPaths build(ref<Store> evalStore, ref<Store> store, Realise mode,
|
||||||
pathsToBuild.insert(pathsToBuild.end(), b.begin(), b.end());
|
pathsToBuild.insert(pathsToBuild.end(), b.begin(), b.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Realise::Nothing)
|
if (mode == Realise::Nothing || mode == Realise::Derivation)
|
||||||
printMissing(store, pathsToBuild, lvlError);
|
printMissing(store, pathsToBuild, lvlError);
|
||||||
else if (mode == Realise::Outputs)
|
else if (mode == Realise::Outputs)
|
||||||
store->buildPaths(pathsToBuild, bMode, evalStore);
|
store->buildPaths(pathsToBuild, bMode, evalStore);
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
|
||||||
{
|
{
|
||||||
auto buildables = build(
|
auto buildables = build(
|
||||||
getEvalStore(), store,
|
getEvalStore(), store,
|
||||||
dryRun ? Realise::Nothing : Realise::Outputs,
|
dryRun ? Realise::Derivation : Realise::Outputs,
|
||||||
installables, buildMode);
|
installables, buildMode);
|
||||||
|
|
||||||
if (json) logger->cout("%s", derivedPathsWithHintsToJSON(buildables, store).dump());
|
if (json) logger->cout("%s", derivedPathsWithHintsToJSON(buildables, store).dump());
|
||||||
|
|
Loading…
Reference in a new issue