From 3999439fbb3d455def815fc873aceea8c9b7d117 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 15 Jul 2020 22:13:21 -0400 Subject: feat(3p/nix): Add OptimiseStore Change-Id: I0d254504801283e018eef41bd5ea9850b17c0d80 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1205 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/nix/src/nix-daemon/nix-daemon.cc | 3 ++- third_party/nix/src/proto/worker.proto | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'third_party') diff --git a/third_party/nix/src/nix-daemon/nix-daemon.cc b/third_party/nix/src/nix-daemon/nix-daemon.cc index da3d909f1820..5296199380b3 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon.cc @@ -630,12 +630,13 @@ static void performOp(TunnelLogger* logger, const ref& store, break; } - case wopOptimiseStore: + case wopOptimiseStore: { logger->startWork(); store->optimiseStore(); logger->stopWork(); to << 1; break; + } case wopVerifyStore: { bool checkContents; diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto index d3e8f65f200d..ad1810b4d569 100644 --- a/third_party/nix/src/proto/worker.proto +++ b/third_party/nix/src/proto/worker.proto @@ -78,6 +78,10 @@ service Worker { // Return all currently valid derivations that have the given store path as an // output. rpc QueryValidDerivers(StorePath) returns (StorePaths); + + // Optimise the disk space usage of the Nix store by hard-linking files + // with the same contents. + rpc OptimiseStore(google.protobuf.Empty) returns (google.protobuf.Empty); } enum HashType { -- cgit 1.4.1