Do not gate or hide experimental settings
This is somewhat hacky fix just for 2.15. I unintentionally hid them
from the manual, when no one wanted to hide them that (including
myself). I also required the experimental feature to be enabled in an
order-dependent way, which is not good.
The simplest fix for this immanent release is just to always show them,
and always allow them to be set.
Effectively undoes some changes from aa663b7e89
This commit is contained in:
parent
0a54624275
commit
450e5ec618
|
@ -70,17 +70,10 @@ void AbstractConfig::reapplyUnknownSettings()
|
||||||
set(s.first, s.second);
|
set(s.first, s.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whether we should process the option. Excludes aliases, which are handled elsewhere, and disabled features.
|
|
||||||
static bool applicable(const Config::SettingData & sd)
|
|
||||||
{
|
|
||||||
return !sd.isAlias
|
|
||||||
&& experimentalFeatureSettings.isEnabled(sd.setting->experimentalFeature);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly)
|
void Config::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly)
|
||||||
{
|
{
|
||||||
for (auto & opt : _settings)
|
for (auto & opt : _settings)
|
||||||
if (applicable(opt.second) && (!overriddenOnly || opt.second.setting->overridden))
|
if (!opt.second.isAlias && (!overriddenOnly || opt.second.setting->overridden))
|
||||||
res.emplace(opt.first, SettingInfo{opt.second.setting->to_string(), opt.second.setting->description});
|
res.emplace(opt.first, SettingInfo{opt.second.setting->to_string(), opt.second.setting->description});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +147,7 @@ nlohmann::json Config::toJSON()
|
||||||
{
|
{
|
||||||
auto res = nlohmann::json::object();
|
auto res = nlohmann::json::object();
|
||||||
for (auto & s : _settings)
|
for (auto & s : _settings)
|
||||||
if (applicable(s.second))
|
if (!s.second.isAlias)
|
||||||
res.emplace(s.first, s.second.setting->toJSON());
|
res.emplace(s.first, s.second.setting->toJSON());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +156,7 @@ std::string Config::toKeyValue()
|
||||||
{
|
{
|
||||||
auto res = std::string();
|
auto res = std::string();
|
||||||
for (auto & s : _settings)
|
for (auto & s : _settings)
|
||||||
if (applicable(s.second))
|
if (s.second.isAlias)
|
||||||
res += fmt("%s = %s\n", s.first, s.second.setting->to_string());
|
res += fmt("%s = %s\n", s.first, s.second.setting->to_string());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -171,9 +164,6 @@ std::string Config::toKeyValue()
|
||||||
void Config::convertToArgs(Args & args, const std::string & category)
|
void Config::convertToArgs(Args & args, const std::string & category)
|
||||||
{
|
{
|
||||||
for (auto & s : _settings) {
|
for (auto & s : _settings) {
|
||||||
/* We do include args for settings gated on disabled
|
|
||||||
experimental-features. The args themselves however will also be
|
|
||||||
gated on any experimental feature the underlying setting is. */
|
|
||||||
if (!s.second.isAlias)
|
if (!s.second.isAlias)
|
||||||
s.second.setting->convertToArg(args, category);
|
s.second.setting->convertToArg(args, category);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
# Without flakes, flake options should not show up
|
# Skipping these two for now, because we actually *do* want flags and
|
||||||
# With flakes, flake options should show up
|
# config settings to always show up in the manual, just be marked
|
||||||
|
# experimental. Will reenable once the manual generation takes advantage
|
||||||
function both_ways {
|
# of the JSON metadata on this.
|
||||||
nix --experimental-features 'nix-command' "$@" | grepQuietInverse flake
|
#
|
||||||
nix --experimental-features 'nix-command flakes' "$@" | grepQuiet flake
|
# # Without flakes, flake options should not show up
|
||||||
|
# # With flakes, flake options should show up
|
||||||
# Also, the order should not matter
|
#
|
||||||
nix "$@" --experimental-features 'nix-command' | grepQuietInverse flake
|
# function grep_both_ways {
|
||||||
nix "$@" --experimental-features 'nix-command flakes' | grepQuiet flake
|
# nix --experimental-features 'nix-command' "$@" | grepQuietInverse flake
|
||||||
}
|
# nix --experimental-features 'nix-command flakes' "$@" | grepQuiet flake
|
||||||
|
#
|
||||||
# Simple case, the configuration effects the running command
|
# # Also, the order should not matter
|
||||||
both_ways show-config
|
# nix "$@" --experimental-features 'nix-command' | grepQuietInverse flake
|
||||||
|
# nix "$@" --experimental-features 'nix-command flakes' | grepQuiet flake
|
||||||
# Skipping for now, because we actually *do* want these to show up in
|
# }
|
||||||
# the manual, just be marked experimental. Will reenable once the manual
|
#
|
||||||
# generation takes advantage of the JSON metadata on this.
|
# # Simple case, the configuration effects the running command
|
||||||
|
# grep_both_ways show-config
|
||||||
# both_ways store gc --help
|
#
|
||||||
|
# # Medium case, the configuration effects --help
|
||||||
|
# grep_both_ways store gc --help
|
||||||
|
|
||||||
expect 1 nix --experimental-features 'nix-command' show-config --flake-registry 'https://no'
|
expect 1 nix --experimental-features 'nix-command' show-config --flake-registry 'https://no'
|
||||||
nix --experimental-features 'nix-command flakes' show-config --flake-registry 'https://no'
|
nix --experimental-features 'nix-command flakes' show-config --flake-registry 'https://no'
|
||||||
|
|
Loading…
Reference in a new issue