Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
get-drvs.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/expr/eval.hh
"
5
#include "
nix/store/path.hh
"
6
7
#include <string>
8
#include <map>
9
10
namespace
nix {
11
15
struct
PackageInfo
16
{
17
public
:
18
typedef
std::map<std::string, std::optional<StorePath>, std::less<>> Outputs;
19
20
private
:
21
EvalState
* state;
22
23
mutable
std::string name;
24
mutable
std::string system;
25
mutable
std::optional<std::optional<StorePath>> drvPath;
26
mutable
std::optional<StorePath> outPath;
27
mutable
std::string outputName;
28
Outputs outputs;
29
33
bool
failed =
false
;
34
35
const
Bindings
*attrs =
nullptr
, *meta =
nullptr
;
36
37
const
Bindings
* getMeta();
38
39
bool
checkMeta(
Value
& v);
40
41
public
:
45
std::string
attrPath
;
46
47
PackageInfo(
EvalState
& state)
48
: 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)
78
{
79
name = s;
80
}
81
82
void
setDrvPath(StorePath path)
83
{
84
drvPath = {{std::move(path)}};
85
}
86
87
void
setOutPath(StorePath path)
88
{
89
outPath = {{std::move(path)}};
90
}
91
92
void
setFailed()
93
{
94
failed =
true
;
95
};
96
97
bool
hasFailed()
98
{
99
return
failed;
100
};
101
};
102
103
typedef
std::list<PackageInfo, traceable_allocator<PackageInfo>> PackageInfos;
104
109
std::optional<PackageInfo> getDerivation(
EvalState
& state,
Value
& v,
bool
ignoreAssertionFailures);
110
111
void
getDerivations(
112
EvalState
& state,
113
Value
& v,
114
const
std::string & pathPrefix,
115
const
Bindings
& autoArgs,
116
PackageInfos & drvs,
117
bool
ignoreAssertionFailures);
118
119
}
// namespace nix
nix::Bindings
Definition
attr-set.hh:67
nix::EvalState
Definition
eval.hh:420
nix::StorePath
Definition
path.hh:33
nix::ref
Definition
ref.hh:58
eval.hh
path.hh
nix::PackageInfo
Definition
get-drvs.hh:16
nix::PackageInfo::attrPath
std::string attrPath
Definition
get-drvs.hh:45
nix::PackageInfo::queryOutputs
Outputs queryOutputs(bool withPaths=true, bool onlyOutputsToInstall=false)
Definition
get-drvs.cc:107
nix::Value
Definition
value.hh:1166
nix::StringSet
std::set< std::string, std::less<> > StringSet
Definition
types.hh:45
libexpr
include
nix
expr
get-drvs.hh
Generated by
1.18.0