about summary refs log tree commit diff
path: root/src/nix/installables.hh
blob: a58f7dc59bb446454d1113d637bac426a7a6ec1f (plain) (blame)
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 "args.hh"

namespace nix {

struct UserEnvElem
{
    Strings attrPath;

    // FIXME: should use boost::variant or so.
    bool isDrv;

    // Derivation case:
    Path drvPath;
    StringSet outputNames;

    // Non-derivation case:
    PathSet outPaths;
};

typedef std::vector<UserEnvElem> UserEnvElems;

struct Value;
class EvalState;

struct MixInstallables : virtual Args
{
    Strings installables;
    Path file;

    MixInstallables()
    {
        mkFlag('f', "file", "file", "evaluate FILE rather than the default", &file);
        expectArgs("installables", &installables);
    }

    UserEnvElems evalInstallables(ref<Store> store);

    /* Return a value representing the Nix expression from which we
       are installing. This is either the file specified by ‘--file’,
       or an attribute set constructed from $NIX_PATH, e.g. ‘{ nixpkgs
       = import ...; bla = import ...; }’. */
    Value * buildSourceExpr(EvalState & state);

};

}