Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
built-path.hh
Go to the documentation of this file.
1#pragma once
3
6
7namespace nix {
8
9struct SingleBuiltPath;
10
12{
14 std::pair<std::string, StorePath> output;
15
16 SingleDerivedPathBuilt discardOutputPath() const;
17
18 std::string to_string(const StoreDirConfig & store) const;
19 static SingleBuiltPathBuilt parse(const StoreDirConfig & store, std::string_view, std::string_view);
20 nlohmann::json toJSON(const StoreDirConfig & store) const;
21
22 bool operator==(const SingleBuiltPathBuilt &) const noexcept;
23 std::strong_ordering operator<=>(const SingleBuiltPathBuilt &) const noexcept;
24};
25
26using _SingleBuiltPathRaw = std::variant<DerivedPathOpaque, SingleBuiltPathBuilt>;
27
28struct SingleBuiltPath : _SingleBuiltPathRaw
29{
30 using Raw = _SingleBuiltPathRaw;
31 using Raw::Raw;
32
33 using Opaque = DerivedPathOpaque;
34 using Built = SingleBuiltPathBuilt;
35
36 bool operator==(const SingleBuiltPath &) const = default;
37 auto operator<=>(const SingleBuiltPath &) const = default;
38
39 inline const Raw & raw() const
40 {
41 return static_cast<const Raw &>(*this);
42 }
43
44 StorePath outPath() const;
45
46 SingleDerivedPath discardOutputPath() const;
47
48 static SingleBuiltPath parse(const StoreDirConfig & store, std::string_view);
49 nlohmann::json toJSON(const StoreDirConfig & store) const;
50};
51
52static inline ref<SingleBuiltPath> staticDrv(StorePath drvPath)
53{
54 return make_ref<SingleBuiltPath>(SingleBuiltPath::Opaque{drvPath});
55}
56
63{
65 std::map<std::string, StorePath> outputs;
66
67 bool operator==(const BuiltPathBuilt &) const noexcept;
68 // TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
69 // std::strong_ordering operator <=> (const BuiltPathBuilt &) const noexcept;
70
71 std::string to_string(const StoreDirConfig & store) const;
72 static BuiltPathBuilt parse(const StoreDirConfig & store, std::string_view, std::string_view);
73 nlohmann::json toJSON(const StoreDirConfig & store) const;
74};
75
76using _BuiltPathRaw = std::variant<DerivedPath::Opaque, BuiltPathBuilt>;
77
82struct BuiltPath : _BuiltPathRaw
83{
84 using Raw = _BuiltPathRaw;
85 using Raw::Raw;
86
87 using Opaque = DerivedPathOpaque;
88 using Built = BuiltPathBuilt;
89
90 bool operator==(const BuiltPath &) const = default;
91
92 // TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
93 // auto operator <=> (const BuiltPath &) const = default;
94
95 inline const Raw & raw() const
96 {
97 return static_cast<const Raw &>(*this);
98 }
99
100 StorePathSet outPaths() const;
101 RealisedPath::Set toRealisedPaths(Store & store) const;
102
103 nlohmann::json toJSON(const StoreDirConfig & store) const;
104};
105
106typedef std::vector<BuiltPath> BuiltPaths;
107
108SingleBuiltPath getBuiltPath(ref<Store> evalStore, ref<Store> store, const SingleDerivedPath & b);
109
110struct KeyedBuildResult;
111
112BuiltPath toBuiltPath(KeyedBuildResult & result, ref<Store> evalStore, ref<Store> store);
113
114} // namespace nix
Definition path.hh:33
Definition store-api.hh:397
Definition ref.hh:58
Definition built-path.hh:63
Definition built-path.hh:83
Definition derived-path.hh:26
Definition build-result.hh:204
Definition built-path.hh:12
Definition built-path.hh:29
Definition derived-path.hh:46
Definition derived-path.hh:105
Definition store-dir-config.hh:29