12#include <nlohmann/json_fwd.hpp>
22namespace nix::fetchers {
37 friend struct InputScheme;
39 std::shared_ptr<InputScheme> scheme;
53 static Input fromURL(
const std::string & url,
bool requireTree =
true);
66 std::string toURLString(
const StringMap & extraQuery = {})
const;
68 std::string to_string()
const;
70 Attrs toAttrs()
const;
89 std::optional<std::filesystem::path>
isRelative()
const;
103 bool operator==(
const Input & other)
const;
105 bool operator<(
const Input & other)
const
107 return attrs < other.attrs;
110 bool contains(
const Input & other)
const;
116 std::pair<StorePath, Input> fetchToStore(
const Settings & settings,
Store & store)
const;
129 static void checkLocks(Input specified, Input & result);
140 std::pair<ref<SourceAccessor>, Input> getAccessorUnchecked(
const Settings & settings,
Store & store)
const;
144 Input applyOverrides(std::optional<std::string>
ref, std::optional<Hash> rev)
const;
146 void clone(
const Settings & settings,
Store & store,
const std::filesystem::path & destDir)
const;
148 std::optional<std::filesystem::path> getSourcePath()
const;
154 void putFile(
const CanonPath & path, std::string_view contents, std::optional<std::string> commitMsg)
const;
156 std::string getName()
const;
161 std::string getType()
const;
162 std::optional<Hash> getNarHash()
const;
163 std::optional<std::string> getRef()
const;
164 std::optional<Hash> getRev()
const;
165 std::optional<uint64_t> getRevCount()
const;
166 std::optional<time_t> getLastModified()
const;
192 virtual std::optional<Input> inputFromURL(
const ParsedURL & url,
bool requireTree)
const = 0;
194 virtual std::optional<Input> inputFromAttrs(
const Attrs & attrs)
const = 0;
213 const char * type =
"String";
214 bool required =
true;
215 const char * doc =
"";
225 virtual const std::map<std::string, AttributeInfo> &
allowedAttrs()
const = 0;
229 virtual Input applyOverrides(
const Input & input, std::optional<std::string>
ref, std::optional<Hash> rev)
const;
232 clone(
const Settings & settings,
Store & store,
const Input & input,
const std::filesystem::path & destDir)
const;
234 virtual std::optional<std::filesystem::path> getSourcePath(
const Input & input)
const;
236 virtual void putFile(
239 std::string_view contents,
240 std::optional<std::string> commitMsg)
const;
242 virtual std::pair<ref<SourceAccessor>,
Input>
250 virtual bool isDirect(
const Input & input)
const
255 virtual std::optional<std::string> getFingerprint(
Store & store,
const Input & input)
const
260 virtual bool isLocked(
const Settings & settings,
const Input & input)
const
265 virtual std::optional<std::filesystem::path> isRelative(
const Input & input)
const
274 virtual std::optional<ParsedURL>
localRepoURL(
const std::filesystem::path & path)
const
279 virtual std::optional<std::string>
280 getAccessToken(
const fetchers::Settings & settings,
const std::string & host,
const std::string & url)
const
286void registerInputScheme(std::shared_ptr<InputScheme> && fetcher);
288using InputSchemeMap = std::map<std::string_view, std::shared_ptr<InputScheme>>;
293const InputSchemeMap & getAllInputSchemes();
300std::optional<ParsedURL> getLocalRepoURL(
const std::filesystem::path & path);
304 std::string type =
"ssh-ed25519";
307 auto operator<=>(
const PublicKey &)
const =
default;
310std::string publicKeys_to_string(
const std::vector<PublicKey> &);
std::map< std::string, Attr > Attrs
Definition attrs.hh:68
Definition canon-path.hh:50
Definition globals.hh:106
Definition store-api.hh:397
Definition source-accessor.hh:50
Definition fetchers.hh:303
Definition fetch-settings.hh:27
std::map< std::string, std::string, std::less<> > StringMap
Definition types.hh:26