about summary refs log tree commit diff
path: root/third_party/nix/src/nix/optimise-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix/optimise-store.cc')
-rw-r--r--third_party/nix/src/nix/optimise-store.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/nix/src/nix/optimise-store.cc b/third_party/nix/src/nix/optimise-store.cc
new file mode 100644
index 000000000000..5fdcfb742465
--- /dev/null
+++ b/third_party/nix/src/nix/optimise-store.cc
@@ -0,0 +1,27 @@
+#include <atomic>
+
+#include "command.hh"
+#include "shared.hh"
+#include "store-api.hh"
+
+using namespace nix;
+
+struct CmdOptimiseStore : StoreCommand {
+  CmdOptimiseStore() = default;
+
+  std::string name() override { return "optimise-store"; }
+
+  std::string description() override {
+    return "replace identical files in the store by hard links";
+  }
+
+  Examples examples() override {
+    return {
+        Example{"To optimise the Nix store:", "nix optimise-store"},
+    };
+  }
+
+  void run(ref<Store> store) override { store->optimiseStore(); }
+};
+
+static RegisterCommand r1(make_ref<CmdOptimiseStore>());