Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
flakeref.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include <regex>
5
#include <iosfwd>
6
#include <string>
7
#include <tuple>
8
#include <utility>
9
10
#include "
nix/store/outputs-spec.hh
"
11
#include "
nix/fetchers/registry.hh
"
12
13
namespace
nix {
14
15
class
Store
;
16
17
namespace
fetchers {
18
struct
Settings
;
19
}
// namespace fetchers
20
21
typedef
std::string FlakeId;
22
43
struct
FlakeRef
44
{
49
fetchers::Input
input
;
50
56
std::string
subdir
;
57
58
bool
operator==(
const
FlakeRef & other)
const
=
default
;
59
60
bool
operator<(
const
FlakeRef & other)
const
61
{
62
return
std::tie(
input
,
subdir
) < std::tie(other.
input
, other.
subdir
);
63
}
64
65
FlakeRef
(
fetchers::Input
&&
input
,
const
std::string &
subdir
)
66
:
input
(std::move(
input
))
67
,
subdir
(
subdir
)
68
{
69
}
70
71
// FIXME: change to operator <<.
72
std::string to_string()
const
;
73
74
fetchers::Attrs toAttrs()
const
;
75
76
FlakeRef resolve(
77
const
fetchers::Settings & fetchSettings,
78
Store & store,
79
fetchers::UseRegistries useRegistries = fetchers::UseRegistries::All)
const
;
80
81
static
FlakeRef fromAttrs(
const
fetchers::Attrs & attrs);
82
83
std::pair<ref<SourceAccessor>, FlakeRef> lazyFetch(
const
fetchers::Settings & fetchSettings, Store & store)
const
;
84
89
FlakeRef
canonicalize
()
const
;
90
};
91
92
std::ostream & operator<<(std::ostream & str,
const
FlakeRef
& flakeRef);
93
97
FlakeRef
parseFlakeRef(
98
std::string_view url,
99
const
std::optional<std::filesystem::path> & baseDir = {},
100
bool
allowMissing =
false
,
101
bool
isFlake =
true
,
102
bool
preserveRelativePaths =
false
);
103
107
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
108
std::string_view url,
109
const
std::optional<std::filesystem::path> & baseDir = {},
110
bool
allowMissing =
false
,
111
bool
isFlake =
true
,
112
bool
preserveRelativePaths =
false
);
113
117
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
118
std::string_view url,
119
const
std::optional<std::filesystem::path> & baseDir = {},
120
bool
allowMissing =
false
,
121
bool
isFlake =
true
);
122
123
static
const
std::string flakeIdRegexS =
"[a-zA-Z][a-zA-Z0-9_-]*"
;
124
extern
std::regex flakeIdRegex;
125
126
}
// namespace nix
nix::Store
Definition
store-api.hh:397
outputs-spec.hh
registry.hh
nix::FlakeRef
Definition
flakeref.hh:44
nix::FlakeRef::canonicalize
FlakeRef canonicalize() const
Definition
flakeref.cc:295
nix::FlakeRef::subdir
std::string subdir
Definition
flakeref.hh:56
nix::FlakeRef::input
fetchers::Input input
Definition
flakeref.hh:49
nix::fetchers::Input
Definition
fetchers.hh:36
nix::fetchers::Settings
Definition
fetch-settings.hh:27
libflake
include
nix
flake
flakeref.hh
Generated by
1.18.0