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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "lix/libcmd/command.hh"
#include "lix/libmain/common-args.hh"
#include "lix/libutil/json.hh"
#include "realisation.hh"

namespace nix {

struct CmdRealisation : MultiCommand
{
    CmdRealisation() : MultiCommand(CommandRegistry::getCommandsFor({"realisation"}))
    { }

    std::string description() override
    {
        return "manipulate a Nix realisation";
    }

    Category category() override { return catUtility; }

    void run() override
    {
        if (!command)
            throw UsageError("'nix realisation' requires a sub-command.");
        command->second->run();
    }
};

struct CmdRealisationInfo : BuiltPathsCommand, MixJSON
{
    CmdRealisationInfo() : BuiltPathsCommand(false) {}

    std::string description() override
    {
        return "query information about one or several realisations";
    }

    std::string doc() override
    {
        return
            #include "realisation/info.md"
            ;
    }

    Category category() override { return catSecondary; }

    void run(ref<Store> store, BuiltPaths && paths) override
    {
        throw UnimplementedError("CA derivations are no longer supported");
    }
};

void registerNixRealisation()
{
    registerCommand<CmdRealisation>("realisation");
    registerCommand2<CmdRealisationInfo>({"realisation", "info"});
}

}