From 717391731cfd85f2e9f5186ed69c2f832a7b86b9 Mon Sep 17 00:00:00 2001 From: detroyejr Date: Fri, 22 Mar 2024 19:30:03 -0400 Subject: [PATCH 1/5] flakes: remove experimental repl-flake --- src/libutil/experimental-features.cc | 10 ---------- src/libutil/experimental-features.hh | 1 - src/nix/repl.cc | 9 --------- 3 files changed, 20 deletions(-) diff --git a/src/libutil/experimental-features.cc b/src/libutil/experimental-features.cc index 374e674af..4fc07afaf 100644 --- a/src/libutil/experimental-features.cc +++ b/src/libutil/experimental-features.cc @@ -203,16 +203,6 @@ constexpr std::array xpFeatureDetails )", .trackingUrl = "https://github.com/NixOS/nix/milestone/40", }, - { - .tag = Xp::ReplFlake, - .name = "repl-flake", - .description = R"( - *Enabled with [`flakes`](#xp-feature-flakes) since 2.19* - - Allow passing [installables](@docroot@/command-ref/new-cli/nix.md#installables) to `nix repl`, making its interface consistent with the other experimental commands. - )", - .trackingUrl = "https://github.com/NixOS/nix/milestone/32", - }, { .tag = Xp::AutoAllocateUids, .name = "auto-allocate-uids", diff --git a/src/libutil/experimental-features.hh b/src/libutil/experimental-features.hh index eae4fa9b8..47c21280f 100644 --- a/src/libutil/experimental-features.hh +++ b/src/libutil/experimental-features.hh @@ -26,7 +26,6 @@ enum struct ExperimentalFeature RecursiveNix, NoUrlLiterals, FetchClosure, - ReplFlake, AutoAllocateUids, Cgroups, DaemonTrustOverride, diff --git a/src/nix/repl.cc b/src/nix/repl.cc index 63fe3044b..8bbfe0f07 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -47,15 +47,6 @@ struct CmdRepl : RawInstallablesCommand void applyDefaultInstallables(std::vector & rawInstallables) override { - if (!experimentalFeatureSettings.isEnabled(Xp::Flakes) && !(file) && rawInstallables.size() >= 1) { - warn("future versions of Nix will require using `--file` to load a file"); - if (rawInstallables.size() > 1) - warn("more than one input file is not currently supported"); - auto filePath = rawInstallables[0].data(); - file = std::optional(filePath); - rawInstallables.front() = rawInstallables.back(); - rawInstallables.pop_back(); - } if (rawInstallables.empty() && (file.has_value() || expr.has_value())) { rawInstallables.push_back("."); } From c625b4535724ebefc2bef11beb4bec212587fdb5 Mon Sep 17 00:00:00 2001 From: detroyejr Date: Fri, 22 Mar 2024 21:39:48 -0400 Subject: [PATCH 2/5] flakes: add remove-repl-flake.md note --- doc/manual/rl-next/remove-repl-flake.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doc/manual/rl-next/remove-repl-flake.md diff --git a/doc/manual/rl-next/remove-repl-flake.md b/doc/manual/rl-next/remove-repl-flake.md new file mode 100644 index 000000000..16a899c3c --- /dev/null +++ b/doc/manual/rl-next/remove-repl-flake.md @@ -0,0 +1,12 @@ +--- +synopsis: Remove experimental repl-flake +significant: significant +issues: 10103 +prs: 10299 +--- + +This PR removes the repl-flake feature that was adopted to provide a migration path when changing the behavior of `nix repl`. Moving forward this command will behave more like the rest of the modern cli. + +- Removes any repl-flake references. +- Removes the parts of `applyDefaultInstallables` that are no longer needed in repl.cc. +- Fix/Add any tests. From b11dd58fe4bd75b25a0f458888dd0ceb8d7d62e1 Mon Sep 17 00:00:00 2001 From: detroyejr Date: Fri, 22 Mar 2024 21:56:19 -0400 Subject: [PATCH 3/5] flakes: test to ensure we get an error if --file isn't used --- tests/functional/repl.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/functional/repl.sh b/tests/functional/repl.sh index 4938c2267..f11fa7140 100644 --- a/tests/functional/repl.sh +++ b/tests/functional/repl.sh @@ -47,6 +47,9 @@ testRepl () { | grep "attribute 'currentSystem' missing" nix repl "${nixArgs[@]}" 2>&1 <<< "builtins.currentSystem" \ | grep "$(nix-instantiate --eval -E 'builtins.currentSystem')" + + expectStderr 1 nix repl ${testDir}/simple.nix \ + | grepQuiet -s "error: path '$testDir/simple.nix' is not a flake" } # Simple test, try building a drv From 50885b81c929779bffe5fea4199688d21e9f707b Mon Sep 17 00:00:00 2001 From: detroyejr Date: Sat, 23 Mar 2024 06:31:49 -0400 Subject: [PATCH 4/5] fix: correct remove-repl-flake.md --- doc/manual/rl-next/remove-repl-flake.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/rl-next/remove-repl-flake.md b/doc/manual/rl-next/remove-repl-flake.md index 16a899c3c..a4ddeaf59 100644 --- a/doc/manual/rl-next/remove-repl-flake.md +++ b/doc/manual/rl-next/remove-repl-flake.md @@ -1,6 +1,6 @@ --- synopsis: Remove experimental repl-flake -significant: significant +significance: significant issues: 10103 prs: 10299 --- From a09d0e19c11a9b92cfca3898ccf8c32a04a7973c Mon Sep 17 00:00:00 2001 From: Jonathan De Troye Date: Fri, 29 Mar 2024 08:57:41 -0400 Subject: [PATCH 5/5] flakes: Reword doc/manual/rl-next/remove-repl-flake.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> --- doc/manual/rl-next/remove-repl-flake.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/manual/rl-next/remove-repl-flake.md b/doc/manual/rl-next/remove-repl-flake.md index a4ddeaf59..23298e2ed 100644 --- a/doc/manual/rl-next/remove-repl-flake.md +++ b/doc/manual/rl-next/remove-repl-flake.md @@ -5,8 +5,4 @@ issues: 10103 prs: 10299 --- -This PR removes the repl-flake feature that was adopted to provide a migration path when changing the behavior of `nix repl`. Moving forward this command will behave more like the rest of the modern cli. - -- Removes any repl-flake references. -- Removes the parts of `applyDefaultInstallables` that are no longer needed in repl.cc. -- Fix/Add any tests. +The `repl-flake` experimental feature has been removed. The `nix repl` command now works like the rest of the new CLI in that `nix repl {path}` now tries to load a flake at `{path}` (or fails if the `flakes` experimental feature isn't enabled).*