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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#pragma once
#include <map>
#include <string>
#include "libexpr/eval.hh"
namespace nix {
struct DrvInfo {
public:
typedef std::map<std::string, Path> Outputs;
private:
EvalState* state;
mutable std::string name;
mutable std::string system;
mutable std::string drvPath;
mutable std::string outPath;
mutable std::string outputName;
Outputs outputs;
bool failed = false; // set if we get an AssertionError
std::shared_ptr<Bindings> attrs = nullptr;
std::shared_ptr<Bindings> meta = nullptr;
Bindings* getMeta();
bool checkMeta(Value& v);
public:
std::string attrPath; /* path towards the derivation */
DrvInfo(EvalState& state) : state(&state){};
DrvInfo(EvalState& state, std::string attrPath,
std::shared_ptr<Bindings> attrs);
DrvInfo(EvalState& state, const ref<Store>& store,
const std::string& drvPathWithOutputs);
std::string queryName() const;
std::string querySystem() const;
std::string queryDrvPath() const;
std::string queryOutPath() const;
std::string queryOutputName() const;
/** Return the list of outputs. The "outputs to install" are determined by
* `meta.outputsToInstall`. */
Outputs queryOutputs(bool onlyOutputsToInstall = false);
StringSet queryMetaNames();
Value* queryMeta(const std::string& name);
std::string queryMetaString(const std::string& name);
NixInt queryMetaInt(const std::string& name, NixInt def);
NixFloat queryMetaFloat(const std::string& name, NixFloat def);
bool queryMetaBool(const std::string& name, bool def);
void setMeta(const std::string& name, Value* v);
/*
MetaInfo queryMetaInfo(EvalState & state) const;
MetaValue queryMetaInfo(EvalState & state, const std::string & name) const;
*/
void setName(const std::string& s) { name = s; }
void setDrvPath(const std::string& s) { drvPath = s; }
void setOutPath(const std::string& s) { outPath = s; }
void setFailed() { failed = true; };
bool hasFailed() { return failed; };
};
typedef std::list<DrvInfo> DrvInfos;
/* If value `v' denotes a derivation, return a DrvInfo object
describing it. Otherwise return nothing. */
std::optional<DrvInfo> getDerivation(EvalState& state, Value& v,
bool ignoreAssertionFailures);
void getDerivations(EvalState& state, Value& v, const std::string& pathPrefix,
Bindings* autoArgs, DrvInfos& drvs,
bool ignoreAssertionFailures);
} // namespace nix
|