summaryrefslogtreecommitdiff
path: root/nix/libstore
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-14 17:59:32 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-19 23:25:01 +0100
commitc7c7f068c15e419aaf5ef616516aa5ad4e55c2fa (patch)
treef672bba546f451bb452174ebf24d30a68ea644ee /nix/libstore
parent3c799ccb98ba2ea4c19747306289586e42ae493b (diff)
daemon: Delegate deduplication to 'guix substitute'.
This removes the main source of latency between subsequent downloads. * nix/libstore/build.cc (SubstitutionGoal::tryToRun): Add a "deduplicate" key to ENV. (SubstitutionGoal::finished): Remove call to 'optimisePath'. * guix/scripts/substitute.scm (process-substitution)[destination-in-store?] [dump-file/deduplicate*]: New variables. Pass #:dump-file to 'restore-file'. * guix/scripts/substitute.scm (guix-substitute)[deduplicate?]: New variable. Pass #:deduplicate? to 'process-substitution'. * guix/serialization.scm (dump-file): Export and augment 'dump-file'.
Diffstat (limited to 'nix/libstore')
-rw-r--r--nix/libstore/build.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index ea809c6971..20d83fea4a 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2984,7 +2984,12 @@ void SubstitutionGoal::tryToRun()
if (!worker.substituter) {
const Strings args = { "substitute", "--substitute" };
- const std::map<string, string> env = { { "_NIX_OPTIONS", settings.pack() } };
+ const std::map<string, string> env = {
+ { "_NIX_OPTIONS",
+ settings.pack() + "deduplicate="
+ + (settings.autoOptimiseStore ? "yes" : "no")
+ }
+ };
worker.substituter = std::make_shared<Agent>(settings.guixProgram, args, env);
}
@@ -3085,10 +3090,8 @@ void SubstitutionGoal::finished()
if (repair) replaceValidPath(storePath, destPath);
- /* Note: 'guix substitute' takes care of resetting timestamps and
- permissions on 'destPath', so no need to do it here. */
-
- worker.store.optimisePath(storePath); // FIXME: combine with hashPath()
+ /* Note: 'guix substitute' takes care of resetting timestamps and of
+ deduplicating 'destPath', so no need to do it here. */
ValidPathInfo info2;
info2.path = storePath;