From 4112dd1fc93c9ff03a5a4e8be773c45ebefbbd1f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 25 Sep 2023 17:08:04 +0200 Subject: [PATCH 1/3] Mark fetchTree as stable --- doc/manual/src/release-notes/rl-next.md | 4 +++- src/libexpr/primops/fetchTree.cc | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/manual/src/release-notes/rl-next.md b/doc/manual/src/release-notes/rl-next.md index 418c1187c..c905f445f 100644 --- a/doc/manual/src/release-notes/rl-next.md +++ b/doc/manual/src/release-notes/rl-next.md @@ -6,4 +6,6 @@ - The experimental feature `repl-flake` is no longer needed, as its functionality is now part of the `flakes` experimental feature. To get the previous behavior, use the `--file/--expr` flags accordingly. -- Introduce new flake installable syntax `flakeref#.attrPath` where the "." prefix denotes no searching of default attribute prefixes like `packages.` or `legacyPackages.`. \ No newline at end of file +- Introduce new flake installable syntax `flakeref#.attrPath` where the "." prefix denotes no searching of default attribute prefixes like `packages.` or `legacyPackages.`. + +- `builtins.fetchTree` is now marked as stable. diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 3d7a85047..0335e5f36 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -213,7 +213,6 @@ static RegisterPrimOp primop_fetchTree({ ``` )", .fun = prim_fetchTree, - .experimentalFeature = Xp::Flakes, }); static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v, From f62b5500ff96cc46e610da13dcf72c134935642d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Oct 2023 14:52:34 +0200 Subject: [PATCH 2/3] fetchTree: Require the flakes experimental feature for the URL syntax --- src/libexpr/primops/fetchTree.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 0335e5f36..3431ff013 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -148,6 +148,11 @@ static void fetchTree( attrs.emplace("url", fixGitURL(url)); input = fetchers::Input::fromAttrs(std::move(attrs)); } else { + if (!experimentalFeatureSettings.isEnabled(Xp::Flakes)) + state.debugThrowLastTrace(EvalError({ + .msg = hintfmt("passing a string argument to 'fetchTree' requires the 'flakes' experimental feature"), + .errPos = state.positions[pos] + })); input = fetchers::Input::fromURL(url); } } @@ -180,6 +185,10 @@ static RegisterPrimOp primop_fetchTree({ *input* must be a [flake reference](@docroot@/command-ref/new-cli/nix3-flake.md#flake-references), either in attribute set representation or in the URL-like syntax. The input should be "locked", that is, it should contain a commit hash or content hash unless impure evaluation (`--impure`) is enabled. + > **Note** + > + > The URL-like syntax requires the [`flakes` experimental feature](@docroot@/contributing/experimental-features.md#xp-feature-flakes) to be enabled. + Here are some examples of how to use `fetchTree`: - Fetch a GitHub repository using the attribute set representation: From 3470cd68c46334d9d2c55e890f7fe50fa9ebe35c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Oct 2023 14:57:29 +0200 Subject: [PATCH 3/3] Mark some fetchers as experimental --- src/libfetchers/github.cc | 5 +++++ src/libfetchers/path.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 291f457f0..6c5c792ec 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -223,6 +223,11 @@ struct GitArchiveInputScheme : InputScheme return {result.tree.storePath, input}; } + + std::optional experimentalFeature() override + { + return Xp::Flakes; + } }; struct GitHubInputScheme : GitArchiveInputScheme diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc index 01f1be978..092975f5d 100644 --- a/src/libfetchers/path.cc +++ b/src/libfetchers/path.cc @@ -125,6 +125,11 @@ struct PathInputScheme : InputScheme return {std::move(*storePath), input}; } + + std::optional experimentalFeature() override + { + return Xp::Flakes; + } }; static auto rPathInputScheme = OnStartup([] { registerInputScheme(std::make_unique()); });