about summary refs log tree commit diff
path: root/third_party/nix/src/nix/optimise-store.cc
blob: ceb53aa77b17756952113c8b4b8a1c9b467baf99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <atomic>

#include "libmain/shared.hh"
#include "libstore/store-api.hh"
#include "nix/command.hh"

namespace nix {
struct CmdOptimiseStore final : 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(); }
};
}  // namespace nix

static nix::RegisterCommand r1(nix::make_ref<nix::CmdOptimiseStore>());