mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
flakes: adopt repl-flake behavior as default
This commit is contained in:
parent
ea2fa8b6f3
commit
13ed5d7106
5 changed files with 9 additions and 10 deletions
|
@ -3,3 +3,5 @@
|
||||||
- [URL flake references](@docroot@/command-ref/new-cli/nix3-flake.md#flake-references) now support [percent-encoded](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1) characters.
|
- [URL flake references](@docroot@/command-ref/new-cli/nix3-flake.md#flake-references) now support [percent-encoded](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1) characters.
|
||||||
|
|
||||||
- [Path-like flake references](@docroot@/command-ref/new-cli/nix3-flake.md#path-like-syntax) now accept arbitrary unicode characters (except `#` and `?`).
|
- [Path-like flake references](@docroot@/command-ref/new-cli/nix3-flake.md#path-like-syntax) now accept arbitrary unicode characters (except `#` and `?`).
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
|
@ -163,6 +163,8 @@ constexpr std::array<ExperimentalFeatureDetails, 14> xpFeatureDetails = {{
|
||||||
.tag = Xp::ReplFlake,
|
.tag = Xp::ReplFlake,
|
||||||
.name = "repl-flake",
|
.name = "repl-flake",
|
||||||
.description = R"(
|
.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.
|
Allow passing [installables](@docroot@/command-ref/new-cli/nix.md#installables) to `nix repl`, making its interface consistent with the other experimental commands.
|
||||||
)",
|
)",
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct CmdRepl : RawInstallablesCommand
|
||||||
|
|
||||||
void applyDefaultInstallables(std::vector<std::string> & rawInstallables) override
|
void applyDefaultInstallables(std::vector<std::string> & rawInstallables) override
|
||||||
{
|
{
|
||||||
if (!experimentalFeatureSettings.isEnabled(Xp::ReplFlake) && !(file) && rawInstallables.size() >= 1) {
|
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes) && !(file) && rawInstallables.size() >= 1) {
|
||||||
warn("future versions of Nix will require using `--file` to load a file");
|
warn("future versions of Nix will require using `--file` to load a file");
|
||||||
if (rawInstallables.size() > 1)
|
if (rawInstallables.size() > 1)
|
||||||
warn("more than one input file is not currently supported");
|
warn("more than one input file is not currently supported");
|
||||||
|
|
|
@ -36,7 +36,7 @@ R""(
|
||||||
Loading Installable ''...
|
Loading Installable ''...
|
||||||
Added 1 variables.
|
Added 1 variables.
|
||||||
|
|
||||||
# nix repl --extra-experimental-features 'flakes repl-flake' nixpkgs
|
# nix repl --extra-experimental-features 'flakes' nixpkgs
|
||||||
Loading Installable 'flake:nixpkgs#'...
|
Loading Installable 'flake:nixpkgs#'...
|
||||||
Added 5 variables.
|
Added 5 variables.
|
||||||
|
|
||||||
|
|
|
@ -105,18 +105,13 @@ testReplResponseNoRegex '
|
||||||
testReplResponse '
|
testReplResponse '
|
||||||
drvPath
|
drvPath
|
||||||
' '".*-simple.drv"' \
|
' '".*-simple.drv"' \
|
||||||
$testDir/simple.nix
|
--file $testDir/simple.nix
|
||||||
|
|
||||||
testReplResponse '
|
testReplResponse '
|
||||||
drvPath
|
drvPath
|
||||||
' '".*-simple.drv"' \
|
' '".*-simple.drv"' \
|
||||||
--file $testDir/simple.nix --experimental-features 'ca-derivations'
|
--file $testDir/simple.nix --experimental-features 'ca-derivations'
|
||||||
|
|
||||||
testReplResponse '
|
|
||||||
drvPath
|
|
||||||
' '".*-simple.drv"' \
|
|
||||||
--file $testDir/simple.nix --extra-experimental-features 'repl-flake ca-derivations'
|
|
||||||
|
|
||||||
mkdir -p flake && cat <<EOF > flake/flake.nix
|
mkdir -p flake && cat <<EOF > flake/flake.nix
|
||||||
{
|
{
|
||||||
outputs = { self }: {
|
outputs = { self }: {
|
||||||
|
@ -130,7 +125,7 @@ EOF
|
||||||
testReplResponse '
|
testReplResponse '
|
||||||
foo + baz
|
foo + baz
|
||||||
' "3" \
|
' "3" \
|
||||||
./flake ./flake\#bar --experimental-features 'flakes repl-flake'
|
./flake ./flake\#bar --experimental-features 'flakes'
|
||||||
|
|
||||||
# Test the `:reload` mechansim with flakes:
|
# Test the `:reload` mechansim with flakes:
|
||||||
# - Eval `./flake#changingThing`
|
# - Eval `./flake#changingThing`
|
||||||
|
@ -143,7 +138,7 @@ sleep 1 # Leave the repl the time to eval 'foo'
|
||||||
sed -i 's/beforeChange/afterChange/' flake/flake.nix
|
sed -i 's/beforeChange/afterChange/' flake/flake.nix
|
||||||
echo ":reload"
|
echo ":reload"
|
||||||
echo "changingThing"
|
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 beforeChange
|
||||||
echo "$replResult" | grepQuiet -s afterChange
|
echo "$replResult" | grepQuiet -s afterChange
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue