diff --git a/src/nix/build.cc b/src/nix/build.cc
index d924fe553b04d13a7c8ae5e7ed1ad9f32915a96a..15923ebc3d9f4dbc4332f9260ca7411397bf1435 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -69,8 +69,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
                             store2->addPermRoot(bo.path, absPath(symlink));
                         },
                         [&](BuiltPath::Built bfd) {
-                            auto builtOutputs = store->queryDerivationOutputMap(bfd.drvPath);
-                            for (auto & output : builtOutputs) {
+                            for (auto & output : bfd.outputs) {
                                 std::string symlink = outLink;
                                 if (i) symlink += fmt("-%d", i);
                                 if (output.first != "out") symlink += fmt("-%s", output.first);