Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::ExperimentalFeatureSettings Struct Reference
Inheritance diagram for nix::ExperimentalFeatureSettings:
nix::Config nix::AbstractConfig

Public Member Functions

bool isEnabled (const ExperimentalFeature &) const
void require (const ExperimentalFeature &, std::string reason="") const
template<typename GetReason>
requires std::invocable<GetReason> && std::convertible_to<std::invoke_result_t<GetReason>, std::string>
void require (const ExperimentalFeature &feature, const GetReason &getReason) const
bool isEnabled (const std::optional< ExperimentalFeature > &) const
void require (const std::optional< ExperimentalFeature > &) const
Public Member Functions inherited from nix::Config
 Config (StringMap initials={})
bool set (const std::string &name, const std::string &value) override
void addSetting (AbstractSetting *setting)
void getSettings (std::map< std::string, SettingInfo > &res, bool overriddenOnly=false) const override
void resetOverridden () override
nlohmann::json toJSON () override
std::string toKeyValue (bool overriddenOnly=false) override
void convertToArgs (Args &args, const std::string &category) override
Public Member Functions inherited from nix::AbstractConfig
void applyConfig (const std::string &contents, const std::string &path="<unknown>")
void warnUnknownSettings ()
void reapplyUnknownSettings ()

Public Attributes

Setting< std::set< ExperimentalFeature > > experimentalFeatures

Additional Inherited Members

Public Types inherited from nix::Config
using Settings = std::map<std::string, SettingData>
Protected Member Functions inherited from nix::AbstractConfig
 AbstractConfig (StringMap initials={})
Protected Attributes inherited from nix::AbstractConfig
StringMap unknownSettings

Member Function Documentation

◆ isEnabled() [1/2]

bool nix::ExperimentalFeatureSettings::isEnabled ( const ExperimentalFeature & feature) const

Check whether the given experimental feature is enabled.

◆ isEnabled() [2/2]

bool nix::ExperimentalFeatureSettings::isEnabled ( const std::optional< ExperimentalFeature > & feature) const

std::nullopt pointer means no feature, which means there is nothing that could be disabled, and so the function returns true in that case.

◆ require() [1/3]

void nix::ExperimentalFeatureSettings::require ( const ExperimentalFeature & feature,
std::string reason = "" ) const

Require an experimental feature be enabled, throwing an error if it is not.

◆ require() [2/3]

template<typename GetReason>
requires std::invocable<GetReason> && std::convertible_to<std::invoke_result_t<GetReason>, std::string>
void nix::ExperimentalFeatureSettings::require ( const ExperimentalFeature & feature,
const GetReason & getReason ) const
inline

Require an experimental feature be enabled, throwing an error if it is not. The reason is lazily evaluated only if the feature is disabled.

◆ require() [3/3]

void nix::ExperimentalFeatureSettings::require ( const std::optional< ExperimentalFeature > & feature) const

std::nullopt pointer means no feature, which means there is nothing that could be disabled, and so the function does nothing in that case.

Member Data Documentation

◆ experimentalFeatures

Setting<std::set<ExperimentalFeature> > nix::ExperimentalFeatureSettings::experimentalFeatures
Initial value:
{
this,
{},
"experimental-features",
R"(
Experimental features that are enabled.
Example:
```
experimental-features = nix-command flakes
```
The following experimental features are available:
{{#include experimental-features-shortlist.md}}
Experimental features are [further documented in the manual](@docroot@/development/experimental-features.md).
)"}

The documentation for this struct was generated from the following files: