mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 22:32:26 +00:00
Break down the fetch-tree
experimental-feature
Add two new features: - `fetch-tree-git` to enable the `git` fetcher for `fetchTree` - `fetch-tree-urls` to enable the URL-like syntax for `fetchTree` `fetch-tree` is kept as a backwards-compatibility alias for the two new features.
This commit is contained in:
parent
a6c36e8c40
commit
f0fd3f7c0a
@ -159,9 +159,9 @@ static void fetchTree(
|
||||
}
|
||||
input = fetchers::Input::fromAttrs(std::move(attrs));
|
||||
} else {
|
||||
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes))
|
||||
if (!experimentalFeatureSettings.isEnabled(Xp::FetchTreeUrls))
|
||||
state.error<EvalError>(
|
||||
"passing a string argument to 'fetchTree' requires the 'flakes' experimental feature"
|
||||
"passing a string argument to 'fetchTree' requires the 'fetch-tree-urls' experimental feature"
|
||||
).atPos(pos).debugThrow();
|
||||
input = fetchers::Input::fromURL(url);
|
||||
}
|
||||
|
@ -282,6 +282,11 @@ struct GitInputScheme : InputScheme
|
||||
return res;
|
||||
}
|
||||
|
||||
std::optional<ExperimentalFeature> experimentalFeature() const override
|
||||
{
|
||||
return Xp::FetchTreeGit;
|
||||
}
|
||||
|
||||
void clone(const Input & input, const Path & destDir) const override
|
||||
{
|
||||
auto repoInfo = getRepoInfo(input);
|
||||
|
@ -334,8 +334,14 @@ template<> std::set<ExperimentalFeature> BaseSetting<std::set<ExperimentalFeatur
|
||||
for (auto & s : tokenizeString<StringSet>(str)) {
|
||||
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) {
|
||||
res.insert(thisXpFeature.value());
|
||||
if (thisXpFeature.value() == Xp::Flakes)
|
||||
if (thisXpFeature.value() == Xp::Flakes) {
|
||||
res.insert(Xp::FetchTree);
|
||||
res.insert(Xp::FetchTreeGit);
|
||||
res.insert(Xp::FetchTreeUrls);
|
||||
} else if (thisXpFeature.value() == Xp::FetchTree) {
|
||||
res.insert(Xp::FetchTreeGit);
|
||||
res.insert(Xp::FetchTreeUrls);
|
||||
}
|
||||
} else
|
||||
warn("unknown experimental feature '%s'", s);
|
||||
}
|
||||
|
@ -78,13 +78,23 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
|
||||
.tag = Xp::FetchTree,
|
||||
.name = "fetch-tree",
|
||||
.description = R"(
|
||||
Enable the use of the [`fetchTree`](@docroot@/language/builtins.md#builtins-fetchTree) built-in function in the Nix language.
|
||||
|
||||
`fetchTree` exposes a generic interface for fetching remote file system trees from different types of remote sources.
|
||||
The [`flakes`](#xp-feature-flakes) feature flag always enables `fetch-tree`.
|
||||
This built-in was previously guarded by the `flakes` experimental feature because of that overlap.
|
||||
|
||||
Enabling just this feature serves as a "release candidate", allowing users to try it out in isolation.
|
||||
Backwards-compatibility alias for
|
||||
[fetch-tree-git](#xp-feature-fetch-tree-git) and
|
||||
[fetch-tree-urls](#xp-feature-fetch-tree-urls).
|
||||
)",
|
||||
},
|
||||
{
|
||||
.tag = Xp::FetchTreeGit,
|
||||
.name = "fetch-tree-git",
|
||||
.description = R"(
|
||||
Enable the use of the `git` [`fetchTree`](@docroot@/language/builtins.md#builtins-fetchTree) fetcher.
|
||||
)",
|
||||
},
|
||||
{
|
||||
.tag = Xp::FetchTreeUrls,
|
||||
.name = "fetch-tree-urls",
|
||||
.description = R"(
|
||||
Enable the use of the [URL-like syntax](@docroot@/command-ref/new-cli/nix3-flake.html#url-like-syntax) in [`fetchTree`](@docroot@/language/builtins.md#builtins-fetchTree).
|
||||
)",
|
||||
},
|
||||
{
|
||||
|
@ -21,6 +21,8 @@ enum struct ExperimentalFeature
|
||||
ImpureDerivations,
|
||||
Flakes,
|
||||
FetchTree,
|
||||
FetchTreeGit,
|
||||
FetchTreeUrls,
|
||||
NixCommand,
|
||||
GitHashing,
|
||||
RecursiveNix,
|
||||
|
Loading…
Reference in New Issue
Block a user