Compare commits
5 Commits
string-str
...
stabilize-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd5e9d2778 | ||
|
|
2d72715aa3 | ||
|
|
9553fc5a53 | ||
|
|
f0fd3f7c0a | ||
|
|
a6c36e8c40 |
9
doc/manual/rl-next/stabilize-fetchtree.md
Normal file
9
doc/manual/rl-next/stabilize-fetchtree.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
synopsis: Stabilize fetchTree
|
||||
prs: 10068
|
||||
---
|
||||
|
||||
The core of `fetchTree` is now stable.
|
||||
This includes
|
||||
- the `fetchTree` function itself
|
||||
- all the existing fetchers, except `git` (still unstable because of some reproducibility concerns)
|
||||
@@ -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);
|
||||
}
|
||||
@@ -410,7 +410,6 @@ static RegisterPrimOp primop_fetchTree({
|
||||
> ```
|
||||
)",
|
||||
.fun = prim_fetchTree,
|
||||
.experimentalFeature = Xp::FetchTree,
|
||||
});
|
||||
|
||||
static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -232,6 +232,12 @@ enableFeatures() {
|
||||
sed -i 's/experimental-features .*/& '"$features"'/' "$NIX_CONF_DIR"/nix.conf
|
||||
}
|
||||
|
||||
disableFeature() {
|
||||
local feature="$1"
|
||||
sed -i '/^\(extra-\)\?experimental-features/s/\b'"$feature"'\b//g' "$NIX_CONF_DIR"/nix.conf
|
||||
sed -i '/^\(extra-\)\?experimental-features/s/\b'"$feature"'\b//g' "$NIX_CONF_DIR"/nix.conf.extra
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
onError() {
|
||||
|
||||
@@ -50,8 +50,13 @@ exp_cores=$(nix config show | grep '^cores' | cut -d '=' -f 2 | xargs)
|
||||
exp_features=$(nix config show | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
||||
[[ $prev != $exp_cores ]]
|
||||
[[ $exp_cores == "4242" ]]
|
||||
# flakes implies fetch-tree
|
||||
[[ $exp_features == "fetch-tree flakes nix-command" ]]
|
||||
# flakes implies fetch-tree and a bunch of other things
|
||||
[[ $exp_features == "fetch-tree fetch-tree-git fetch-tree-urls flakes nix-command" ]]
|
||||
[[
|
||||
$(NIX_CONFIG="experimental-features = fetch-tree nix-command" nix config show | grep '^experimental-features' | cut -d '=' -f 2 | xargs) \
|
||||
== \
|
||||
"fetch-tree fetch-tree-git fetch-tree-urls nix-command"
|
||||
]]
|
||||
|
||||
# Test that it's possible to retrieve a single setting's value
|
||||
val=$(nix config show | grep '^warn-dirty' | cut -d '=' -f 2 | xargs)
|
||||
|
||||
@@ -2,6 +2,8 @@ source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
disableFeature "flakes"
|
||||
|
||||
cd "$TEST_ROOT"
|
||||
|
||||
test_fetch_file () {
|
||||
@@ -21,6 +23,7 @@ EOF
|
||||
# Make sure that `http(s)` and `file` flake inputs are properly extracted when
|
||||
# they should be, and treated as opaque files when they should be
|
||||
test_file_flake_input () {
|
||||
enableFeatures "flakes"
|
||||
rm -fr "$TEST_ROOT/testFlake";
|
||||
mkdir "$TEST_ROOT/testFlake";
|
||||
pushd testFlake
|
||||
|
||||
Reference in New Issue
Block a user