mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
Allow substituting from different storeDir
Substituters can substitute from one store dir to another with a little bit of help. The store api just needs to have a CA so it can recompute the store path based on the new store dir. We can only do this for fixed output derivations with no references, though.
This commit is contained in:
parent
d558fb98f6
commit
79c169d1c6
7 changed files with 50 additions and 9 deletions
|
@ -580,6 +580,13 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
|
|||
|
||||
uint64_t total = 0;
|
||||
|
||||
// recompute store path on the chance dstStore does it differently
|
||||
if (hasPrefix(info->ca, "fixed:") && info->references.empty()) {
|
||||
auto info2 = make_ref<ValidPathInfo>(*info);
|
||||
info2->path = dstStore->makeStorePath("output:out", hashString(htSHA256, info->ca), storePath.name());
|
||||
info = info2;
|
||||
}
|
||||
|
||||
if (!info->narHash) {
|
||||
StringSink sink;
|
||||
srcStore->narFromPath({storePath}, sink);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue