1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 18:41:47 +02:00

nix-store -r: do substitutions in parallel

I.e. when multiple non-derivation arguments are passed to ‘nix-store
-r’ to be substituted, do them in parallel.
This commit is contained in:
Eelco Dolstra 2012-06-27 16:58:15 -04:00
parent 42f5a2fc29
commit 1aba0bf0fa
11 changed files with 30 additions and 25 deletions

View file

@ -62,7 +62,7 @@ static Path useDeriver(Path path)
static PathSet realisePath(const Path & path)
{
if (isDerivation(path)) {
store->buildDerivations(singleton<PathSet>(path));
store->buildPaths(singleton<PathSet>(path));
Derivation drv = derivationFromPath(*store, path);
PathSet outputs;
@ -101,13 +101,11 @@ static void opRealise(Strings opFlags, Strings opArgs)
if (dryRun) return;
/* Build all derivations at the same time to exploit parallelism. */
PathSet drvPaths;
foreach (Strings::iterator, i, opArgs)
if (isDerivation(*i)) drvPaths.insert(*i);
store->buildDerivations(drvPaths);
/* Build all paths at the same time to exploit parallelism. */
PathSet paths(opArgs.begin(), opArgs.end());
store->buildPaths(paths);
foreach (Strings::iterator, i, opArgs) {
foreach (Paths::iterator, i, opArgs) {
PathSet paths = realisePath(*i);
foreach (PathSet::iterator, j, paths)
cout << format("%1%\n") % *j;