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
#pragma once

#include <lix/libexpr/flake/flake.hh>
#include <lix/libutil/args/root.hh>
#include <lix/libcmd/common-eval-args.hh>
#include <lix/libutil/async.hh>
#include <stddef.h>
#include <lix/libmain/common-args.hh>
#include <lix/libexpr/flake/flakeref.hh>
#include <lix/libutil/types.hh>
#include <string>
#include <optional>

struct MyArgs : virtual public nix::MixEvalArgs,
               virtual public nix::MixCommonArgs,
               virtual public nix::RootArgs {
    nix::AsyncIoRoot & aio_;
    nix::AsyncIoRoot & aio() override { return aio_; }

    // stash the command line to be able to pass it to the worker
    nix::Strings cmdline;

    bool worker = false;
    std::string releaseExpr;
    nix::Path gcRootsDir;
    bool flake = false;
    bool fromArgs = false;
    bool meta = false;
    bool showTrace = false;
    bool impure = false;
    bool forceRecurse = false;
    bool checkCacheStatus = false;
    bool constituents = false;
    bool noInstantiate = false;
    size_t nrWorkers = 1;
    size_t maxMemorySize = 4096;

    // usually in MixFlakeOptions
    nix::flake::LockFlags lockFlags = {.updateLockFile = false,
                                       .writeLockFile = false,
                                       .useRegistries = false,
                                       .allowUnlocked = false};

    MyArgs(nix::AsyncIoRoot & aio);
    MyArgs(const MyArgs&) = delete;

    void parseArgs(char** argv, int argc);
};