diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-07 18:51:01 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-07 18:51:01 +0000 |
commit | 8f92bb5ad9856daaa8488a5dad206b980a2aacb5 (patch) | |
tree | 6a3470a7ac7bb85580116dc3dad50d597c95a5f9 /src/nix/build.cc | |
parent | 46f9dd56da7d2af82148c47e40108f3c11ffe4d7 (diff) | |
parent | f7ba16f9cbc27b141f1797a7c4f1fd3243f31683 (diff) |
Merge branch 'drv-outputs-map-allow-missing' of github.com:obsidiansystems/nix into templated-daemon-protocol
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r-- | src/nix/build.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc index 613cc15eb..13d14a7fb 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -64,17 +64,24 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile if (dryRun) return; - if (outLink != "") { - for (size_t i = 0; i < buildables.size(); ++i) { - for (auto & output : buildables[i].outputs) - if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) { - std::string symlink = outLink; - if (i) symlink += fmt("-%d", i); - if (output.first != "out") symlink += fmt("-%s", output.first); - store2->addPermRoot(output.second, absPath(symlink), true); - } - } - } + if (outLink != "") + if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) + for (size_t i = 0; i < buildables.size(); ++i) + std::visit(overloaded { + [&](BuildableOpaque bo) { + std::string symlink = outLink; + if (i) symlink += fmt("-%d", i); + store2->addPermRoot(bo.path, absPath(symlink), true); + }, + [&](BuildableFromDrv bfd) { + for (auto & output : bfd.outputs) { + std::string symlink = outLink; + if (i) symlink += fmt("-%d", i); + if (output.first != "out") symlink += fmt("-%s", output.first); + store2->addPermRoot(output.second, absPath(symlink), true); + } + }, + }, buildables[i]); updateProfile(buildables); } |