Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
derived-path.hh
Go to the documentation of this file.
1#pragma once
3
8#include "lix/libutil/json-fwd.hh"
9#include "lix/libutil/ref.hh"
10#include "lix/libutil/result.hh"
11
12#include <kj/async.h>
13#include <variant>
14
15namespace nix {
16
17class Store;
18
27 StorePath path;
28
29 std::string to_string(const Store & store) const;
30 static DerivedPathOpaque parse(const Store & store, std::string_view);
31 kj::Promise<Result<JSON>> toJSON(const Store & store) const;
32
34};
35
37
47 OutputName output;
48
59 const StorePath & getBaseStorePath() const;
60
64 std::string to_string(const Store & store) const;
68 std::string to_string_legacy(const Store & store) const;
75 const Store & store, ref<SingleDerivedPath> drvPath,
76 OutputNameView outputs,
77 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
78 kj::Promise<Result<JSON>> toJSON(Store & store) const;
79
81};
82
83namespace derived_path::detail {
84using SingleDerivedPathRaw = std::variant<
87>;
88}
89
101struct SingleDerivedPath : derived_path::detail::SingleDerivedPathRaw {
102 using Raw = derived_path::detail::SingleDerivedPathRaw;
103 using Raw::Raw;
104
105 using Opaque = DerivedPathOpaque;
106 using Built = SingleDerivedPathBuilt;
107
108 inline const Raw & raw() const {
109 return static_cast<const Raw &>(*this);
110 }
111
122 const StorePath & getBaseStorePath() const;
123
127 std::string to_string(const Store & store) const;
131 std::string to_string_legacy(const Store & store) const;
138 const Store & store,
139 std::string_view,
140 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
147 const Store & store,
148 std::string_view,
149 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
150 kj::Promise<Result<JSON>> toJSON(Store & store) const;
151};
152
153static inline ref<SingleDerivedPath> makeConstantStorePathRef(StorePath drvPath)
154{
155 return make_ref<SingleDerivedPath>(SingleDerivedPath::Opaque { drvPath });
156}
157
172 OutputsSpec outputs;
173
184 const StorePath & getBaseStorePath() const;
185
189 std::string to_string(const Store & store) const;
193 std::string to_string_legacy(const Store & store) const;
199 static DerivedPathBuilt parse(
200 const Store & store, ref<SingleDerivedPath>,
201 std::string_view,
202 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
203 kj::Promise<Result<JSON>> toJSON(Store & store) const;
204
206};
207
208namespace derived_path::detail {
209using DerivedPathRaw = std::variant<
212>;
213}
214
225struct DerivedPath : derived_path::detail::DerivedPathRaw {
226 using Raw = derived_path::detail::DerivedPathRaw;
227 using Raw::Raw;
228
229 using Opaque = DerivedPathOpaque;
230 using Built = DerivedPathBuilt;
231
232 inline const Raw & raw() const {
233 return static_cast<const Raw &>(*this);
234 }
235
246 const StorePath & getBaseStorePath() const;
247
251 std::string to_string(const Store & store) const;
255 std::string to_string_legacy(const Store & store) const;
261 static DerivedPath parse(
262 const Store & store,
263 std::string_view,
264 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
271 const Store & store,
272 std::string_view,
273 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
274
279
280 kj::Promise<Result<JSON>> toJSON(Store & store) const;
281};
282
283typedef std::vector<DerivedPath> DerivedPaths;
284
294void drvRequireExperiment(
295 const SingleDerivedPath & drv,
296 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
297}
Definition path.hh:21
Definition store-api.hh:195
Definition ref.hh:19
#define GENERATE_CMP(args...)
Definition comparator.hh:65
#define DECLARE_CMP(my_type)
Definition comparator.hh:33
std::string_view OutputNameView
Definition outputs-spec.hh:26
std::string OutputName
Definition outputs-spec.hh:20
Definition derived-path.hh:170
std::string to_string(const Store &store) const
Definition derived-path.cc:115
static DerivedPathBuilt parse(const Store &store, ref< SingleDerivedPath >, std::string_view, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:191
const StorePath & getBaseStorePath() const
Definition derived-path.cc:283
std::string to_string_legacy(const Store &store) const
Definition derived-path.cc:122
Definition derived-path.hh:26
Definition derived-path.hh:225
static DerivedPath parseLegacy(const Store &store, std::string_view, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:255
std::string to_string_legacy(const Store &store) const
Definition derived-path.cc:151
const StorePath & getBaseStorePath() const
Definition derived-path.cc:306
static DerivedPath fromSingle(const SingleDerivedPath &)
Definition derived-path.cc:263
static DerivedPath parse(const Store &store, std::string_view, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:247
std::string to_string(const Store &store) const
Definition derived-path.cc:136
Definition outputs-spec.hh:28
Definition derived-path.hh:45
const StorePath & getBaseStorePath() const
Definition derived-path.cc:278
static SingleDerivedPathBuilt parse(const Store &store, ref< SingleDerivedPath > drvPath, OutputNameView outputs, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:179
std::string to_string(const Store &store) const
Definition derived-path.cc:105
std::string to_string_legacy(const Store &store) const
Definition derived-path.cc:110
Definition derived-path.hh:101
std::string to_string_legacy(const Store &store) const
Definition derived-path.cc:143
std::string to_string(const Store &store) const
Definition derived-path.cc:129
static SingleDerivedPath parse(const Store &store, std::string_view, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:231
static SingleDerivedPath parseLegacy(const Store &store, std::string_view, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition derived-path.cc:239
const StorePath & getBaseStorePath() const
Definition derived-path.cc:301