about summary refs log tree commit diff
path: root/src/nix/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-06T14·03+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-06T14·03+0200
commitdf4342bc175a153986ebcf5bce2a758d5353adeb (patch)
treed491cac5bd1c4d45c689fd1a19c98958c32e9674 /src/nix/build.cc
parent1277aab219c83beae856024eea6e868677f7523b (diff)
nix build: Create result symlinks
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r--src/nix/build.cc15
1 files changed, 13 insertions, 2 deletions
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> 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<LocalFSStore>()) {
+                    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);
+                }
+            }
+        }
     }
 };