feat!: remove experimental repl-flakes

This is a backport of CppNix PR 10299

Fixes #557

Change-Id: I848e8c5af4bde09afba053a5911fbbd54004fbb8
This commit is contained in:
KFears
2025-03-17 16:01:53 -07:00
committed by Jade Lovelace
parent 41e10862cb
commit 2c21882767
7 changed files with 30 additions and 20 deletions
+9
View File
@@ -66,6 +66,10 @@ delan:
forgejo: delan
github: delan
detroyejr:
display_name: Jonathan De Troye
github: detroyejr
edolstra:
display_name: Eelco Dolstra
github: edolstra
@@ -102,6 +106,11 @@ jade:
just1602:
forgejo: just1602
kfears:
display_name: KFears
forgejo: kfearsoff
github: kfearsoff
kiara:
github: KiaraGrouwstra
+10
View File
@@ -0,0 +1,10 @@
---
synopsis: Remove experimental repl-flake
issues: [gh#10103, fj#557]
cls: [2147]
prs: [gh#10299]
category: Breaking Changes
credits: [detroyejr, kfears]
---
The `repl-flake` experimental feature flag has been removed, its functionality is now the default when `flakes` experimental feature is active. 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).
@@ -1,5 +0,0 @@
---
name: repl-flake
internalName: ReplFlake
---
Allow passing [installables](@docroot@/command-ref/new-cli/nix.md#installables) to `nix repl`, making its interface consistent with the other experimental commands.
-1
View File
@@ -153,7 +153,6 @@ experimental_feature_definitions = files(
'experimental-features/read-only-local-store.md',
'experimental-features/recursive-nix.md',
'experimental-features/repl-automation.md',
'experimental-features/repl-flake.md',
)
deprecated_feature_definitions = files(
-9
View File
@@ -47,15 +47,6 @@ struct CmdRepl : RawInstallablesCommand
void applyDefaultInstallables(std::vector<std::string> & rawInstallables) override
{
if (!experimentalFeatureSettings.isEnabled(Xp::ReplFlake) && !(file) && rawInstallables.size() >= 1) {
warn("future versions of Lix 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(".");
}
+1 -1
View File
@@ -38,7 +38,7 @@ R""(
Loading Installable ''...
Added 1 variables.
# nix repl --extra-experimental-features 'flakes repl-flake' nixpkgs
# nix repl --extra-experimental-features 'flakes' nixpkgs
Loading Installable 'flake:nixpkgs#'...
Added 5 variables.
+10 -4
View File
@@ -47,6 +47,12 @@ testRepl () {
| grep "attribute 'currentSystem' missing"
nix repl "${nixArgs[@]}" 2>&1 <<< "builtins.currentSystem" \
| grep "$(nix-instantiate --eval -E 'builtins.currentSystem')"
local replOutput="$(nix repl "${nixArgs[@]}" ${testDir}/simple.nix 2>&1)"
echo "$replOutput"
echo "$replOutput" \
| grepQuiet "error: could not find a flake.nix file" \
|| fail "nix repl simple.nix doesn't fail because simple.nix is not a flake"
}
# Simple test, try building a drv
@@ -115,7 +121,7 @@ testReplResponseNoRegex '
testReplResponse '
drvPath
' '".*-simple.drv"' \
$testDir/simple.nix
--file $testDir/simple.nix
testReplResponse '
drvPath
@@ -125,7 +131,7 @@ drvPath
testReplResponse '
drvPath
' '".*-simple.drv"' \
--file $testDir/simple.nix --extra-experimental-features 'repl-flake ca-derivations'
--file $testDir/simple.nix --extra-experimental-features 'ca-derivations'
mkdir -p flake && cat <<EOF > flake/flake.nix
{
@@ -140,7 +146,7 @@ EOF
testReplResponse '
foo + baz
' "3" \
./flake ./flake\#bar --experimental-features 'flakes repl-flake'
./flake ./flake\#bar --experimental-features 'flakes'
# Test the `:reload` mechansim with flakes:
# - Eval `./flake#changingThing`
@@ -153,7 +159,7 @@ sleep 1 # Leave the repl the time to eval 'foo'
sed -i 's/beforeChange/afterChange/' flake/flake.nix
echo ":reload"
echo "changingThing"
) | nix repl ./flake --experimental-features 'flakes repl-flake')
) | nix repl ./flake --experimental-features 'flakes')
echo "$replResult" | grepQuiet -s beforeChange
echo "$replResult" | grepQuiet -s afterChange