forked from lix-project/lix
StorePathCommands: Build installables
So for instance "nix copy --to ... nixpkgs.hello" will build nixpkgs.hello first. It's debatable whether this is a good idea. It seems desirable for commands like "nix copy" but maybe not for commands like "nix path-info".
This commit is contained in:
parent
d48c973ece
commit
c30330df6f
|
@ -115,16 +115,8 @@ void StorePathsCommand::run(ref<Store> store)
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
for (auto & i : installables) {
|
for (auto & p : buildInstallables(store, false))
|
||||||
for (auto & path : i->toBuildable()) {
|
storePaths.push_back(p);
|
||||||
if (isDerivation(path)) {
|
|
||||||
Derivation drv = store->derivationFromPath(path);
|
|
||||||
for (auto & output : drv.outputs)
|
|
||||||
storePaths.push_back(output.second.path);
|
|
||||||
} else
|
|
||||||
storePaths.push_back(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
PathSet closure;
|
PathSet closure;
|
||||||
|
|
|
@ -228,7 +228,16 @@ PathSet InstallablesCommand::buildInstallables(ref<Store> store, bool dryRun)
|
||||||
if (!dryRun)
|
if (!dryRun)
|
||||||
store->buildPaths(buildables);
|
store->buildPaths(buildables);
|
||||||
|
|
||||||
return buildables;
|
PathSet outPaths;
|
||||||
|
for (auto & path : buildables)
|
||||||
|
if (isDerivation(path)) {
|
||||||
|
Derivation drv = store->derivationFromPath(path);
|
||||||
|
for (auto & output : drv.outputs)
|
||||||
|
outPaths.insert(output.second.path);
|
||||||
|
} else
|
||||||
|
outPaths.insert(path);
|
||||||
|
|
||||||
|
return outPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref<EvalState> InstallablesCommand::getEvalState()
|
ref<EvalState> InstallablesCommand::getEvalState()
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct CmdRun : InstallablesCommand
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto paths = buildInstallables(store, false);
|
auto outPaths = buildInstallables(store, false);
|
||||||
|
|
||||||
auto store2 = store.dynamic_pointer_cast<LocalStore>();
|
auto store2 = store.dynamic_pointer_cast<LocalStore>();
|
||||||
|
|
||||||
|
@ -89,14 +89,6 @@ struct CmdRun : InstallablesCommand
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PathSet outPaths;
|
|
||||||
for (auto & path : paths)
|
|
||||||
if (isDerivation(path)) {
|
|
||||||
Derivation drv = store->derivationFromPath(path);
|
|
||||||
for (auto & output : drv.outputs)
|
|
||||||
outPaths.insert(output.second.path);
|
|
||||||
} else
|
|
||||||
outPaths.insert(path);
|
|
||||||
|
|
||||||
auto unixPath = tokenizeString<Strings>(getEnv("PATH"), ":");
|
auto unixPath = tokenizeString<Strings>(getEnv("PATH"), ":");
|
||||||
for (auto & path : outPaths)
|
for (auto & path : outPaths)
|
||||||
|
|
Loading…
Reference in a new issue