mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
23b8b7e096
This replaces "nix-store --optimise". Main difference is that it has a progress indicator.
41 lines
723 B
C++
41 lines
723 B
C++
#include "command.hh"
|
|
#include "shared.hh"
|
|
#include "store-api.hh"
|
|
|
|
#include <atomic>
|
|
|
|
using namespace nix;
|
|
|
|
struct CmdOptimiseStore : StoreCommand
|
|
{
|
|
CmdOptimiseStore()
|
|
{
|
|
}
|
|
|
|
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>());
|