From df4342bc175a153986ebcf5bce2a758d5353adeb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Sep 2017 16:03:22 +0200 Subject: nix build: Create result symlinks --- src/nix/build.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/nix/build.cc') diff --git a/src/nix/build.cc b/src/nix/build.cc index 4239dd3fff9d..64bcafd2d934 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -23,9 +23,20 @@ struct CmdBuild : MixDryRun, InstallablesCommand void run(ref store) override { - auto paths = toStorePaths(store, dryRun ? DryRun : Build); + auto buildables = toBuildables(store, dryRun ? DryRun : Build); - printError("build result: %s", showPaths(paths)); + for (size_t i = 0; i < buildables.size(); ++i) { + auto & b(buildables[i]); + + for (auto & output : b.outputs) { + if (auto store2 = store.dynamic_pointer_cast()) { + std::string symlink = "result"; + if (i) symlink += fmt("-%d", i); + if (output.first != "out") symlink += fmt("-%s", output.first); + store2->addPermRoot(output.second, absPath(symlink), true); + } + } + } } }; -- cgit 1.4.1