Nix 2.26.3
Nix, the purely functional 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 "eval.hh"
5#include "path.hh"
6
7#include <string>
8#include <map>
9
10
11namespace nix {
12
16struct PackageInfo
17{
18public:
19 typedef std::map<std::string, std::optional<StorePath>> Outputs;
20
21private:
22 EvalState * state;
23
24 mutable std::string name;
25 mutable std::string system;
26 mutable std::optional<std::optional<StorePath>> drvPath;
27 mutable std::optional<StorePath> outPath;
28 mutable std::string outputName;
29 Outputs outputs;
30
34 bool failed = false;
35
36 const Bindings * attrs = nullptr, * meta = nullptr;
37
38 const Bindings * getMeta();
39
40 bool checkMeta(Value & v);
41
42public:
46 std::string attrPath;
47
48 PackageInfo(EvalState & state) : state(&state) { };
49 PackageInfo(EvalState & state, std::string attrPath, const Bindings * attrs);
50 PackageInfo(EvalState & state, ref<Store> store, const std::string & drvPathWithOutputs);
51
52 std::string queryName() const;
53 std::string querySystem() const;
54 std::optional<StorePath> queryDrvPath() const;
55 StorePath requireDrvPath() const;
56 StorePath queryOutPath() const;
57 std::string queryOutputName() const;
62 Outputs queryOutputs(bool withPaths = true, bool onlyOutputsToInstall = false);
63
64 StringSet queryMetaNames();
65 Value * queryMeta(const std::string & name);
66 std::string queryMetaString(const std::string & name);
67 NixInt queryMetaInt(const std::string & name, NixInt def);
68 NixFloat queryMetaFloat(const std::string & name, NixFloat def);
69 bool queryMetaBool(const std::string & name, bool def);
70 void setMeta(const std::string & name, Value * v);
71
72 /*
73 MetaInfo queryMetaInfo(EvalState & state) const;
74 MetaValue queryMetaInfo(EvalState & state, const string & name) const;
75 */
76
77 void setName(const std::string & s) { name = s; }
78 void setDrvPath(StorePath path) { drvPath = {{std::move(path)}}; }
79 void setOutPath(StorePath path) { outPath = {{std::move(path)}}; }
80
81 void setFailed() { failed = true; };
82 bool hasFailed() { return failed; };
83};
84
85
86typedef std::list<PackageInfo, traceable_allocator<PackageInfo>> PackageInfos;
87
88
93std::optional<PackageInfo> getDerivation(EvalState & state,
94 Value & v, bool ignoreAssertionFailures);
95
96void getDerivations(EvalState & state, Value & v, const std::string & pathPrefix,
97 Bindings & autoArgs, PackageInfos & drvs,
98 bool ignoreAssertionFailures);
99
100
101}
Definition attr-set.hh:48
Definition eval.hh:182
Definition path.hh:27
Definition ref.hh:15
@ Outputs
Definition installables.hh:23
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
return s
Definition lexer.l:459
const std::string_view & name
Definition lexer.l:1709
std::string path
Definition lexer.l:1399
Definition get-drvs.hh:17
std::string attrPath
Definition get-drvs.hh:46
Outputs queryOutputs(bool withPaths=true, bool onlyOutputsToInstall=false)
Definition get-drvs.cc:111
Definition value.hh:167