forked from lix-project/lix
85c8be6286
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
35 lines
694 B
C++
35 lines
694 B
C++
#include "command.hh"
|
|
#include "shared.hh"
|
|
#include "store-api.hh"
|
|
|
|
#include <atomic>
|
|
|
|
using namespace nix;
|
|
|
|
struct CmdOptimiseStore : StoreCommand
|
|
{
|
|
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"
|
|
},
|
|
};
|
|
}
|
|
|
|
Category category() override { return catUtility; }
|
|
|
|
void run(ref<Store> store) override
|
|
{
|
|
store->optimiseStore();
|
|
}
|
|
};
|
|
|
|
static auto rCmdOptimiseStore = registerCommand<CmdOptimiseStore>("optimise-store");
|