From c30330df6f67c81986dfb124631bc756c8e58c0d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Apr 2017 16:19:22 +0200 Subject: 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". --- src/nix/installables.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/nix/installables.cc') diff --git a/src/nix/installables.cc b/src/nix/installables.cc index ff345c45d..57580049f 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -228,7 +228,16 @@ PathSet InstallablesCommand::buildInstallables(ref store, bool dryRun) if (!dryRun) 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 InstallablesCommand::getEvalState() -- cgit v1.2.3