blob: 5f0b0a2922424a2fec848b08558d8ca9c5688e02 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "args.hh"
#include "command.hh"
namespace nix {
struct Value;
class EvalState;
class Expr;
struct Installable
{
virtual std::string what() = 0;
virtual PathSet toBuildable()
{
throw Error("argument ‘%s’ cannot be built", what());
}
virtual Value * toValue(EvalState & state)
{
throw Error("argument ‘%s’ cannot be evaluated", what());
}
};
struct MixInstallables : virtual Args, StoreCommand
{
std::vector<std::shared_ptr<Installable>> installables;
Path file;
MixInstallables()
{
mkFlag('f', "file", "file", "evaluate FILE rather than the default", &file);
expectArgs("installables", &_installables);
}
/* 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 * getSourceExpr(EvalState & state);
std::vector<std::shared_ptr<Installable>> parseInstallables(ref<Store> store, Strings installables);
PathSet buildInstallables(ref<Store> store, bool dryRun);
ref<EvalState> getEvalState();
void prepare() override;
private:
Strings _installables;
std::shared_ptr<EvalState> evalState;
Value * vSourceExpr = 0;
};
}
|