Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd5e9d2778 | ||
|
|
2d72715aa3 | ||
|
|
9553fc5a53 | ||
|
|
f0fd3f7c0a | ||
|
|
a6c36e8c40 |
No files matched your search
@@ -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));
|
input = fetchers::Input::fromAttrs(std::move(attrs));
|
||||||
} else {
|
} else {
|
||||||
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes))
|
if (!experimentalFeatureSettings.isEnabled(Xp::FetchTreeUrls))
|
||||||
state.error<EvalError>(
|
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();
|
).atPos(pos).debugThrow();
|
||||||
input = fetchers::Input::fromURL(url);
|
input = fetchers::Input::fromURL(url);
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,6 @@ static RegisterPrimOp primop_fetchTree({
|
|||||||
> ```
|
> ```
|
||||||
)",
|
)",
|
||||||
.fun = prim_fetchTree,
|
.fun = prim_fetchTree,
|
||||||
.experimentalFeature = Xp::FetchTree,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v,
|
static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v,
|
||||||
|
|||||||
@@ -282,6 +282,11 @@ struct GitInputScheme : InputScheme
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<ExperimentalFeature> experimentalFeature() const override
|
||||||
|
{
|
||||||
|
return Xp::FetchTreeGit;
|
||||||
|
}
|
||||||
|
|
||||||
void clone(const Input & input, const Path & destDir) const override
|
void clone(const Input & input, const Path & destDir) const override
|
||||||
{
|
{
|
||||||
auto repoInfo = getRepoInfo(input);
|
auto repoInfo = getRepoInfo(input);
|
||||||
|
|||||||
@@ -334,8 +334,14 @@ template<> std::set<ExperimentalFeature> BaseSetting<std::set<ExperimentalFeatur
|
|||||||
for (auto & s : tokenizeString<StringSet>(str)) {
|
for (auto & s : tokenizeString<StringSet>(str)) {
|
||||||
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) {
|
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) {
|
||||||
res.insert(thisXpFeature.value());
|
res.insert(thisXpFeature.value());
|
||||||
if (thisXpFeature.value() == Xp::Flakes)
|
if (thisXpFeature.value() == Xp::Flakes) {
|
||||||
res.insert(Xp::FetchTree);
|
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
|
} else
|
||||||
warn("unknown experimental feature '%s'", s);
|
warn("unknown experimental feature '%s'", s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,13 +78,23 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
|
|||||||
.tag = Xp::FetchTree,
|
.tag = Xp::FetchTree,
|
||||||
.name = "fetch-tree",
|
.name = "fetch-tree",
|
||||||
.description = R"(
|
.description = R"(
|
||||||
Enable the use of the [`fetchTree`](@docroot@/language/builtins.md#builtins-fetchTree) built-in function in the Nix language.
|
Backwards-compatibility alias for
|
||||||
|
[fetch-tree-git](#xp-feature-fetch-tree-git) and
|
||||||
`fetchTree` exposes a generic interface for fetching remote file system trees from different types of remote sources.
|
[fetch-tree-urls](#xp-feature-fetch-tree-urls).
|
||||||
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.
|
.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,
|
ImpureDerivations,
|
||||||
Flakes,
|
Flakes,
|
||||||
FetchTree,
|
FetchTree,
|
||||||
|
FetchTreeGit,
|
||||||
|
FetchTreeUrls,
|
||||||
NixCommand,
|
NixCommand,
|
||||||
GitHashing,
|
GitHashing,
|
||||||
RecursiveNix,
|
RecursiveNix,
|
||||||
|
|||||||
@@ -232,6 +232,12 @@ enableFeatures() {
|
|||||||
sed -i 's/experimental-features .*/& '"$features"'/' "$NIX_CONF_DIR"/nix.conf
|
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
|
set -x
|
||||||
|
|
||||||
onError() {
|
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)
|
exp_features=$(nix config show | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
||||||
[[ $prev != $exp_cores ]]
|
[[ $prev != $exp_cores ]]
|
||||||
[[ $exp_cores == "4242" ]]
|
[[ $exp_cores == "4242" ]]
|
||||||
# flakes implies fetch-tree
|
# flakes implies fetch-tree and a bunch of other things
|
||||||
[[ $exp_features == "fetch-tree flakes nix-command" ]]
|
[[ $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
|
# Test that it's possible to retrieve a single setting's value
|
||||||
val=$(nix config show | grep '^warn-dirty' | cut -d '=' -f 2 | xargs)
|
val=$(nix config show | grep '^warn-dirty' | cut -d '=' -f 2 | xargs)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ source common.sh
|
|||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
|
disableFeature "flakes"
|
||||||
|
|
||||||
cd "$TEST_ROOT"
|
cd "$TEST_ROOT"
|
||||||
|
|
||||||
test_fetch_file () {
|
test_fetch_file () {
|
||||||
@@ -21,6 +23,7 @@ EOF
|
|||||||
# Make sure that `http(s)` and `file` flake inputs are properly extracted when
|
# 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
|
# they should be, and treated as opaque files when they should be
|
||||||
test_file_flake_input () {
|
test_file_flake_input () {
|
||||||
|
enableFeatures "flakes"
|
||||||
rm -fr "$TEST_ROOT/testFlake";
|
rm -fr "$TEST_ROOT/testFlake";
|
||||||
mkdir "$TEST_ROOT/testFlake";
|
mkdir "$TEST_ROOT/testFlake";
|
||||||
pushd testFlake
|
pushd testFlake
|
||||||
|
|||||||
Reference in new issue
Block a user