mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 12:36:01 +01:00
nix copy: Add --out-link
This commit is contained in:
parent
43ad8c5eb2
commit
7f6d006beb
7 changed files with 66 additions and 25 deletions
|
|
@ -334,4 +334,29 @@ void MixEnvironment::setEnviron()
|
|||
}
|
||||
}
|
||||
|
||||
void createOutLinks(
|
||||
const std::filesystem::path & outLink,
|
||||
const BuiltPaths & buildables,
|
||||
LocalFSStore & store)
|
||||
{
|
||||
for (const auto & [_i, buildable] : enumerate(buildables)) {
|
||||
auto i = _i;
|
||||
std::visit(overloaded {
|
||||
[&](const BuiltPath::Opaque & bo) {
|
||||
auto symlink = outLink;
|
||||
if (i) symlink += fmt("-%d", i);
|
||||
store.addPermRoot(bo.path, absPath(symlink.string()));
|
||||
},
|
||||
[&](const BuiltPath::Built & bfd) {
|
||||
for (auto & output : bfd.outputs) {
|
||||
auto symlink = outLink;
|
||||
if (i) symlink += fmt("-%d", i);
|
||||
if (output.first != "out") symlink += fmt("-%s", output.first);
|
||||
store.addPermRoot(output.second, absPath(symlink.string()));
|
||||
}
|
||||
},
|
||||
}, buildable.raw());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue