Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
get-drvs.hh
Go to the documentation of this file.
1#pragma once
3
4#include "lix/libexpr/eval.hh"
7
8#include <string>
9#include <map>
10
11
12namespace nix {
13
14
15struct DrvInfo
16{
17public:
18 typedef std::map<std::string, std::optional<StorePath>> Outputs;
19
20private:
21 std::string name;
22 std::string system;
23 std::optional<std::optional<StorePath>> drvPath;
24 std::optional<StorePath> outPath;
25 std::string outputName;
26 Outputs outputs;
27
31 bool failed = false;
32
33 Bindings * attrs = nullptr, * meta = nullptr;
34
35 Bindings * getMeta(EvalState & state);
36
37 bool checkMeta(EvalState & state, Value & v);
38
39 void fillOutputs(EvalState & state, bool withPaths = true);
40
41 DrvInfo(
42 ref<Store> store,
43 const std::string & drvPathWithOutputs,
44 Derivation drv,
45 const StorePath & drvPath,
46 const std::set<std::string> & selectedOutputs
47 );
48
49public:
53 std::string attrPath;
54
55 DrvInfo(std::string attrPath, Bindings * attrs);
56 static kj::Promise<Result<DrvInfo>>
57 create(ref<Store> store, const std::string & drvPathWithOutputs);
58
59 std::string queryName(EvalState & state);
60 std::string querySystem(EvalState & state);
61 std::optional<StorePath> queryDrvPath(EvalState & state);
62 StorePath requireDrvPath(EvalState & state);
63 StorePath queryOutPath(EvalState & state);
64 std::string queryOutputName(EvalState & state);
69 Outputs queryOutputs(EvalState & state, bool withPaths = true, bool onlyOutputsToInstall = false);
70
71 StringSet queryMetaNames(EvalState & state);
72 Value * queryMeta(EvalState & state, const std::string & name);
73 std::string queryMetaString(EvalState & state, const std::string & name);
74 NixInt queryMetaInt(EvalState & state, const std::string & name, NixInt def);
75 bool queryMetaBool(EvalState & state, const std::string & name, bool def);
76 void setMeta(EvalState & state, const std::string & name, Value * v);
77
78 /*
79 MetaInfo queryMetaInfo(EvalState & state) const;
80 MetaValue queryMetaInfo(EvalState & state, const string & name) const;
81 */
82
83 void setName(const std::string & s) { name = s; }
84 void setDrvPath(StorePath path) { drvPath = {{std::move(path)}}; }
85 void setOutPath(StorePath path) { outPath = {{std::move(path)}}; }
86
87 void setFailed() { failed = true; };
88 bool hasFailed() { return failed; };
89};
90
91using DrvInfos = GcList<DrvInfo>;
92
97std::optional<DrvInfo> getDerivation(EvalState & state,
98 Value & v, bool ignoreAssertionFailures);
99
100void getDerivations(EvalState & state, Value & v, const std::string & pathPrefix,
101 Bindings & autoArgs, DrvInfos & drvs,
102 bool ignoreAssertionFailures);
103
104
105}
Definition attr-set.hh:48
Definition eval.hh:685
Definition path.hh:21
Definition ref.hh:19
Definition derivations.hh:324
Outputs queryOutputs(EvalState &state, bool withPaths=true, bool onlyOutputsToInstall=false)
Definition get-drvs.cc:197
std::string attrPath
Definition get-drvs.hh:53
Definition value.hh:190