mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
repl: add repl-flake experimental feature for gating
This commit is contained in:
parent
0053dab43f
commit
7a04fb1c56
4 changed files with 6 additions and 4 deletions
|
@ -13,6 +13,7 @@ std::map<ExperimentalFeature, std::string> stringifiedXpFeatures = {
|
||||||
{ Xp::RecursiveNix, "recursive-nix" },
|
{ Xp::RecursiveNix, "recursive-nix" },
|
||||||
{ Xp::NoUrlLiterals, "no-url-literals" },
|
{ Xp::NoUrlLiterals, "no-url-literals" },
|
||||||
{ Xp::FetchClosure, "fetch-closure" },
|
{ Xp::FetchClosure, "fetch-closure" },
|
||||||
|
{ Xp::ReplFlake, "repl-flake" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::optional<ExperimentalFeature> parseExperimentalFeature(const std::string_view & name)
|
const std::optional<ExperimentalFeature> parseExperimentalFeature(const std::string_view & name)
|
||||||
|
|
|
@ -22,6 +22,7 @@ enum struct ExperimentalFeature
|
||||||
RecursiveNix,
|
RecursiveNix,
|
||||||
NoUrlLiterals,
|
NoUrlLiterals,
|
||||||
FetchClosure,
|
FetchClosure,
|
||||||
|
ReplFlake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -897,7 +897,7 @@ struct CmdRepl : InstallablesCommand
|
||||||
}
|
}
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
if (!settings.isExperimentalFeatureEnabled(Xp::Flakes) && !(file) && this->_installables.size() >= 1) {
|
if (!settings.isExperimentalFeatureEnabled(Xp::ReplFlake) && !(file) && this->_installables.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 (this->_installables.size() > 1)
|
if (this->_installables.size() > 1)
|
||||||
warn("more than one input file is not currently supported");
|
warn("more than one input file is not currently supported");
|
||||||
|
|
|
@ -87,7 +87,7 @@ drvPath
|
||||||
testReplResponse '
|
testReplResponse '
|
||||||
drvPath
|
drvPath
|
||||||
' '".*-simple.drv"' \
|
' '".*-simple.drv"' \
|
||||||
--file $testDir/simple.nix --experimental-features 'flakes'
|
--file $testDir/simple.nix --experimental-features 'repl-flake'
|
||||||
|
|
||||||
mkdir -p flake && cat <<EOF > flake/flake.nix
|
mkdir -p flake && cat <<EOF > flake/flake.nix
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@ EOF
|
||||||
testReplResponse '
|
testReplResponse '
|
||||||
foo + baz
|
foo + baz
|
||||||
' "3" \
|
' "3" \
|
||||||
./flake ./flake\#bar
|
./flake ./flake\#bar --experimental-features 'flakes repl-flake'
|
||||||
|
|
||||||
# Test the `:reload` mechansim with flakes:
|
# Test the `:reload` mechansim with flakes:
|
||||||
# - Eval `./flake#changingThing`
|
# - Eval `./flake#changingThing`
|
||||||
|
@ -115,6 +115,6 @@ 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)
|
) | nix repl ./flake --experimental-features 'flakes repl-flake')
|
||||||
echo "$replResult" | grep -qs beforeChange
|
echo "$replResult" | grep -qs beforeChange
|
||||||
echo "$replResult" | grep -qs afterChange
|
echo "$replResult" | grep -qs afterChange
|
||||||
|
|
Loading…
Reference in a new issue