diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-12-14 17:59:32 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-12-19 23:25:01 +0100 |
| commit | c7c7f068c15e419aaf5ef616516aa5ad4e55c2fa (patch) | |
| tree | f672bba546f451bb452174ebf24d30a68ea644ee /nix | |
| parent | 3c799ccb98ba2ea4c19747306289586e42ae493b (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')
| -rw-r--r-- | nix/libstore/build.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index ea809c6971c..20d83fea4a8 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc | |||
| @@ -2984,7 +2984,12 @@ void SubstitutionGoal::tryToRun() | |||
| 2984 | 2984 | ||
| 2985 | if (!worker.substituter) { | 2985 | if (!worker.substituter) { |
| 2986 | const Strings args = { "substitute", "--substitute" }; | 2986 | const Strings args = { "substitute", "--substitute" }; |
| 2987 | const std::map<string, string> env = { { "_NIX_OPTIONS", settings.pack() } }; | 2987 | const std::map<string, string> env = { |
| 2988 | { "_NIX_OPTIONS", | ||
| 2989 | settings.pack() + "deduplicate=" | ||
| 2990 | + (settings.autoOptimiseStore ? "yes" : "no") | ||
| 2991 | } | ||
| 2992 | }; | ||
| 2988 | worker.substituter = std::make_shared<Agent>(settings.guixProgram, args, env); | 2993 | worker.substituter = std::make_shared<Agent>(settings.guixProgram, args, env); |
| 2989 | } | 2994 | } |
| 2990 | 2995 | ||
| @@ -3085,10 +3090,8 @@ void SubstitutionGoal::finished() | |||
| 3085 | 3090 | ||
| 3086 | if (repair) replaceValidPath(storePath, destPath); | 3091 | if (repair) replaceValidPath(storePath, destPath); |
| 3087 | 3092 | ||
| 3088 | /* Note: 'guix substitute' takes care of resetting timestamps and | 3093 | /* Note: 'guix substitute' takes care of resetting timestamps and of |
| 3089 | permissions on 'destPath', so no need to do it here. */ | 3094 | deduplicating 'destPath', so no need to do it here. */ |
| 3090 | |||
| 3091 | worker.store.optimisePath(storePath); // FIXME: combine with hashPath() | ||
| 3092 | 3095 | ||
| 3093 | ValidPathInfo info2; | 3096 | ValidPathInfo info2; |
| 3094 | info2.path = storePath; | 3097 | info2.path = storePath; |
