about summary refs log blame commit diff
path: root/third_party/nix/src/nix/optimise-store.cc
blob: 594cc0e637a7302f71fa0c3a4aa28a6a17832a77 (plain) (tree)
1
2
3
4
5
6
7
8
9
                 
 


                                
 

                    
                                        
                               
 
                                                          
 


                                                                
 




                                                                    
 
                                                                 


                                                        
#include <atomic>

#include "libmain/shared.hh"
#include "libstore/store-api.hh"
#include "nix/command.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>());