1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

nix build: Add outro message

This commit is contained in:
Eelco Dolstra 2020-11-27 12:25:51 +01:00
parent 491ba8d1c4
commit 1af0a165d4

View file

@ -56,6 +56,8 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
if (dryRun) return; if (dryRun) return;
PathSet symlinks;
if (outLink != "") if (outLink != "")
if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>())
for (size_t i = 0; i < buildables.size(); ++i) for (size_t i = 0; i < buildables.size(); ++i)
@ -63,7 +65,9 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
[&](BuildableOpaque bo) { [&](BuildableOpaque bo) {
std::string symlink = outLink; std::string symlink = outLink;
if (i) symlink += fmt("-%d", i); if (i) symlink += fmt("-%d", i);
store2->addPermRoot(bo.path, absPath(symlink)); symlink = absPath(symlink);
store2->addPermRoot(bo.path, symlink);
symlinks.insert(symlink);
}, },
[&](BuildableFromDrv bfd) { [&](BuildableFromDrv bfd) {
auto builtOutputs = store->queryDerivationOutputMap(bfd.drvPath); auto builtOutputs = store->queryDerivationOutputMap(bfd.drvPath);
@ -71,14 +75,22 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
std::string symlink = outLink; std::string symlink = outLink;
if (i) symlink += fmt("-%d", i); if (i) symlink += fmt("-%d", i);
if (output.first != "out") symlink += fmt("-%s", output.first); if (output.first != "out") symlink += fmt("-%s", output.first);
store2->addPermRoot(output.second, absPath(symlink)); symlink = absPath(symlink);
store2->addPermRoot(output.second, symlink);
symlinks.insert(symlink);
} }
}, },
}, buildables[i]); }, buildables[i]);
updateProfile(buildables); updateProfile(buildables);
if (json) logger->cout("%s", buildablesToJSON(buildables, store).dump()); if (json)
logger->cout("%s", buildablesToJSON(buildables, store).dump());
else
notice(
ANSI_GREEN "Build succeeded." ANSI_NORMAL
" The result is available through the symlink " ANSI_BOLD "%s" ANSI_NORMAL ".",
showPaths(symlinks));
} }
}; };