1 : #ifndef __GET_DRVS_H
2 : #define __GET_DRVS_H
3 :
4 : #include <string>
5 : #include <map>
6 :
7 : #include <boost/shared_ptr.hpp>
8 :
9 : #include "eval.hh"
10 :
11 :
12 : namespace nix {
13 :
14 :
15 : typedef std::map<string, string> MetaInfo;
16 :
17 :
18 : struct DrvInfo
19 : {
20 : private:
21 : string drvPath;
22 : string outPath;
23 :
24 : public:
25 : string name;
26 : string attrPath; /* path towards the derivation */
27 : string system;
28 :
29 : boost::shared_ptr<ATermMap> attrs;
30 :
31 : string queryDrvPath(EvalState & state) const;
32 : string queryOutPath(EvalState & state) const;
33 : MetaInfo queryMetaInfo(EvalState & state) const;
34 :
35 : void setDrvPath(const string & s)
36 0 : {
37 0 : drvPath = s;
38 : }
39 :
40 : void setOutPath(const string & s)
41 3 : {
42 3 : outPath = s;
43 : }
44 : };
45 :
46 :
47 : typedef list<DrvInfo> DrvInfos;
48 :
49 :
50 : /* Evaluate expression `e'. If it evaluates to a derivation, store
51 : information about the derivation in `drv' and return true.
52 : Otherwise, return false. */
53 : bool getDerivation(EvalState & state, Expr e, DrvInfo & drv);
54 :
55 : void getDerivations(EvalState & state, Expr e, const string & pathPrefix,
56 : const ATermMap & autoArgs, DrvInfos & drvs);
57 :
58 :
59 : }
60 :
61 :
62 : #endif /* !__GET_DRVS_H */
|