mirror of
https://github.com/NixOS/nix.git
synced 2025-12-20 07:51:07 +01:00
Pluggable fetchers
Flakes are now fetched using an extensible mechanism. Also lots of other flake cleanups.
This commit is contained in:
parent
1bf9eb21b7
commit
9f4d8c6170
34 changed files with 1613 additions and 1298 deletions
32
src/libstore/fetchers/regex.hh
Normal file
32
src/libstore/fetchers/regex.hh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <regex>
|
||||
|
||||
namespace nix::fetchers {
|
||||
|
||||
// URI stuff.
|
||||
const static std::string pctEncoded = "%[0-9a-fA-F][0-9a-fA-F]";
|
||||
const static std::string schemeRegex = "[a-z+]+";
|
||||
const static std::string authorityRegex =
|
||||
"(?:(?:[a-z])*@)?"
|
||||
"[a-zA-Z0-9._~-]*";
|
||||
const static std::string segmentRegex = "[a-zA-Z0-9._~-]+";
|
||||
const static std::string pathRegex = "(?:/?" + segmentRegex + "(?:/" + segmentRegex + ")*|/?)";
|
||||
const static std::string pcharRegex =
|
||||
"(?:[a-zA-Z0-9-._~!$&'()*+,;=:@ ]|" + pctEncoded + ")";
|
||||
const static std::string queryRegex = "(?:" + pcharRegex + "|[/?])*";
|
||||
|
||||
// A Git ref (i.e. branch or tag name).
|
||||
const static std::string refRegexS = "[a-zA-Z0-9][a-zA-Z0-9_.-]*"; // FIXME: check
|
||||
extern std::regex refRegex;
|
||||
|
||||
// A Git revision (a SHA-1 commit hash).
|
||||
const static std::string revRegexS = "[0-9a-fA-F]{40}";
|
||||
extern std::regex revRegex;
|
||||
|
||||
// A ref or revision, or a ref followed by a revision.
|
||||
const static std::string refAndOrRevRegex = "(?:(" + revRegexS + ")|(?:(" + refRegexS + ")(?:/(" + revRegexS + "))?))";
|
||||
|
||||
const static std::string flakeId = "[a-zA-Z][a-zA-Z0-9_-]*";
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue