aboutsummaryrefslogtreecommitdiff
path: root/src/nix/optimise-store.cc
blob: b4595187929690e106f3d9a2ec8375a12988520a (plain)
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
28
29
30
31
32
33
34
#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 r1 = registerCommand<CmdOptimiseStore>("optimise-store");