1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Make the flakes experimental feature stable

This commit is contained in:
Graham Christensen 2023-10-29 21:50:35 +00:00 committed by Eelco Dolstra
parent 7747a501db
commit 590920eed2
27 changed files with 59 additions and 107 deletions

View file

@ -22,7 +22,6 @@ EvalSettings evalSettings {
{
"flake",
[](ref<Store> store, std::string_view rest) {
experimentalFeatureSettings.require(Xp::Flakes);
// FIXME `parseFlakeRef` should take a `std::string_view`.
auto flakeRef = parseFlakeRef(std::string { rest }, {}, true, false);
debug("fetching flake search path element '%s''", rest);
@ -229,7 +228,6 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * bas
}
else if (hasPrefix(s, "flake:")) {
experimentalFeatureSettings.require(Xp::Flakes);
auto flakeRef = parseFlakeRef(std::string(s.substr(6)), {}, true, false);
auto storePath = flakeRef.resolve(state.store).fetchTree(state.store).first;
return state.rootPath(CanonPath(state.store->toRealPath(storePath)));

View file

@ -394,9 +394,6 @@ void completeFlakeRefWithFragment(
void completeFlakeRef(AddCompletions & completions, ref<Store> store, std::string_view prefix)
{
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes))
return;
if (prefix == "")
completions.add(".");

View file

@ -163,15 +163,11 @@ static void fetchTree(
}
input = fetchers::Input::fromAttrs(std::move(attrs));
} else {
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes))
state.error<EvalError>(
"passing a string argument to 'fetchTree' requires the 'flakes' experimental feature"
).atPos(pos).debugThrow();
input = fetchers::Input::fromURL(url);
}
}
if (!state.settings.pureEval && !input.isDirect() && experimentalFeatureSettings.isEnabled(Xp::Flakes))
if (!state.settings.pureEval && !input.isDirect())
input = lookupInRegistries(state.store, input).first;
if (state.settings.pureEval && !input.isLocked()) {
@ -383,7 +379,6 @@ static RegisterPrimOp primop_fetchTree({
- `"mercurial"`
*input* can also be a [URL-like reference](@docroot@/command-ref/new-cli/nix3-flake.md#flake-references).
The additional input types and the URL-like syntax requires the [`flakes` experimental feature](@docroot@/contributing/experimental-features.md#xp-feature-flakes) to be enabled.
> **Example**
>
@ -420,7 +415,6 @@ static RegisterPrimOp primop_fetchTree({
> ```
)",
.fun = prim_fetchTree,
.experimentalFeature = Xp::FetchTree,
});
static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v,

View file

@ -299,11 +299,6 @@ struct GitArchiveInputScheme : InputScheme
input.getNarHash().has_value());
}
std::optional<ExperimentalFeature> experimentalFeature() const override
{
return Xp::Flakes;
}
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
{
if (auto rev = input.getRev())

View file

@ -102,11 +102,6 @@ struct IndirectInputScheme : InputScheme
throw Error("indirect input '%s' cannot be fetched directly", input.to_string());
}
std::optional<ExperimentalFeature> experimentalFeature() const override
{
return Xp::Flakes;
}
bool isDirect(const Input & input) const override
{ return false; }
};

View file

@ -174,11 +174,6 @@ struct PathInputScheme : InputScheme
return std::nullopt;
}
}
std::optional<ExperimentalFeature> experimentalFeature() const override
{
return Xp::Flakes;
}
};
static auto rPathInputScheme = OnStartup([] { registerInputScheme(std::make_unique<PathInputScheme>()); });

View file

@ -156,7 +156,7 @@ struct RegistrySettings : Config
When empty, disables the global flake registry.
)",
{}, true, Xp::Flakes};
{}, true};
};
RegistrySettings registrySettings;

View file

@ -22,8 +22,7 @@ struct FlakeSettings : public Config
"use-registries",
"Whether to use flake registries to resolve flake references.",
{},
true,
Xp::Flakes};
true};
Setting<bool> acceptFlakeConfig{
this,
@ -31,8 +30,7 @@ struct FlakeSettings : public Config
"accept-flake-config",
"Whether to accept nix configuration from a flake without prompting.",
{},
true,
Xp::Flakes};
true};
Setting<std::string> commitLockFileSummary{
this,
@ -43,8 +41,7 @@ struct FlakeSettings : public Config
empty, the summary is generated based on the action performed.
)",
{"commit-lockfile-summary"},
true,
Xp::Flakes};
true};
};
// TODO: don't use a global variable.

View file

@ -343,8 +343,6 @@ LockedFlake lockFlake(
const FlakeRef & topRef,
const LockFlags & lockFlags)
{
experimentalFeatureSettings.require(Xp::Flakes);
FlakeCache flakeCache;
auto useRegistries = lockFlags.useRegistries.value_or(flakeSettings.useRegistries);
@ -744,8 +742,6 @@ void callFlake(EvalState & state,
const LockedFlake & lockedFlake,
Value & vRes)
{
experimentalFeatureSettings.require(Xp::Flakes);
auto [lockFileStr, keyMap] = lockedFlake.lockFile.to_string();
auto overrides = state.buildBindings(lockedFlake.nodePaths.size());
@ -837,7 +833,6 @@ static RegisterPrimOp r2({
```
)",
.fun = prim_getFlake,
.experimentalFeature = Xp::Flakes,
});
static void prim_parseFlakeRef(
@ -881,7 +876,6 @@ static RegisterPrimOp r3({
```
)",
.fun = prim_parseFlakeRef,
.experimentalFeature = Xp::Flakes,
});
@ -938,7 +932,6 @@ static RegisterPrimOp r4({
```
)",
.fun = prim_flakeRefToString,
.experimentalFeature = Xp::Flakes,
});
}

View file

@ -341,11 +341,9 @@ template<> std::set<ExperimentalFeature> BaseSetting<std::set<ExperimentalFeatur
{
std::set<ExperimentalFeature> res;
for (auto & s : tokenizeString<StringSet>(str)) {
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) {
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature)
res.insert(thisXpFeature.value());
if (thisXpFeature.value() == Xp::Flakes)
res.insert(Xp::FetchTree);
} else
else
warn("unknown experimental feature '%s'", s);
}
return res;

View file

@ -386,7 +386,7 @@ struct ExperimentalFeatureSettings : Config {
Example:
```
experimental-features = nix-command flakes
experimental-features = nix-command
```
The following experimental features are available:

View file

@ -74,8 +74,9 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
.tag = Xp::Flakes,
.name = "flakes",
.description = R"(
Enable flakes. See the manual entry for [`nix
flake`](@docroot@/command-ref/new-cli/nix3-flake.md) for details.
*Enabled for Determinate Nix Installer users since 2.19*
See the manual entry for [`nix flake`](@docroot@/command-ref/new-cli/nix3-flake.md) for details.
)",
.trackingUrl = "https://github.com/NixOS/nix/milestone/27",
},
@ -83,6 +84,8 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
.tag = Xp::FetchTree,
.name = "fetch-tree",
.description = R"(
*Enabled for Determinate Nix Installer users since 2.24*
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.

View file

@ -1462,12 +1462,6 @@ struct CmdFlake : NixMultiCommand
#include "flake.md"
;
}
void run() override
{
experimentalFeatureSettings.require(Xp::Flakes);
NixMultiCommand::run();
}
};
static auto rCmdFlake = registerCommand<CmdFlake>("flake");

View file

@ -412,7 +412,6 @@ void mainWrapped(int argc, char * * argv)
if (argc == 2 && std::string(argv[1]) == "__dump-language") {
experimentalFeatureSettings.experimentalFeatures = {
Xp::Flakes,
Xp::FetchClosure,
Xp::DynamicDerivations,
Xp::FetchTree,

View file

@ -69,11 +69,9 @@ That is, Nix will operate on the default flake output attribute of the flake in
### Flake output attribute
> **Warning** \
> Flake output attribute installables depend on both the
> [`flakes`](@docroot@/contributing/experimental-features.md#xp-feature-flakes)
> and
> Flake output attribute installables depend on the
> [`nix-command`](@docroot@/contributing/experimental-features.md#xp-feature-nix-command)
> experimental features, and subject to change without notice.
> experimental feature, and subject to change without notice.
Example: `nixpkgs#hello`

View file

@ -36,7 +36,7 @@ R""(
Loading Installable ''...
Added 1 variables.
# nix repl --extra-experimental-features 'flakes' nixpkgs
# nix repl nixpkgs
Loading Installable 'flake:nixpkgs#'...
Added 5 variables.