Nix 2.26.3
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
4#include "derived-path.hh"
5#include "realisation.hh"
6
7namespace nix {
8
9struct SingleBuiltPath;
10
13 std::pair<std::string, StorePath> output;
14
15 SingleDerivedPathBuilt discardOutputPath() const;
16
17 std::string to_string(const StoreDirConfig & store) const;
18 static SingleBuiltPathBuilt parse(const StoreDirConfig & store, std::string_view, std::string_view);
19 nlohmann::json toJSON(const StoreDirConfig & store) const;
20
21 bool operator ==(const SingleBuiltPathBuilt &) const noexcept;
22 std::strong_ordering operator <=>(const SingleBuiltPathBuilt &) const noexcept;
23};
24
25using _SingleBuiltPathRaw = std::variant<
28>;
29
30struct SingleBuiltPath : _SingleBuiltPathRaw {
31 using Raw = _SingleBuiltPathRaw;
32 using Raw::Raw;
33
34 using Opaque = DerivedPathOpaque;
35 using Built = SingleBuiltPathBuilt;
36
37 bool operator == (const SingleBuiltPath &) const = default;
38 auto operator <=> (const SingleBuiltPath &) const = default;
39
40 inline const Raw & raw() const {
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
64 std::map<std::string, StorePath> outputs;
65
66 bool operator == (const BuiltPathBuilt &) const noexcept;
67 // TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
68 //std::strong_ordering operator <=> (const BuiltPathBuilt &) const noexcept;
69
70 std::string to_string(const StoreDirConfig & store) const;
71 static BuiltPathBuilt parse(const StoreDirConfig & store, std::string_view, std::string_view);
72 nlohmann::json toJSON(const StoreDirConfig & store) const;
73};
74
75using _BuiltPathRaw = std::variant<
76 DerivedPath::Opaque,
78>;
79
84struct BuiltPath : _BuiltPathRaw {
85 using Raw = _BuiltPathRaw;
86 using Raw::Raw;
87
88 using Opaque = DerivedPathOpaque;
89 using Built = BuiltPathBuilt;
90
91 bool operator == (const BuiltPath &) const = default;
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 return static_cast<const Raw &>(*this);
97 }
98
99 StorePathSet outPaths() const;
100 RealisedPath::Set toRealisedPaths(Store & store) const;
101
102 nlohmann::json toJSON(const StoreDirConfig & store) const;
103};
104
105typedef std::vector<BuiltPath> BuiltPaths;
106
107}
Definition path.hh:27
Definition store-api.hh:169
Definition ref.hh:15
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
virtual nlohmann::json toJSON()=0
Definition built-path.hh:62
Definition built-path.hh:84
Definition derived-path.hh:27
Definition built-path.hh:11
Definition built-path.hh:30
Definition derived-path.hh:47
Definition derived-path.hh:102
Definition store-dir-config.hh:22