2021-10-25 13:53:01 +00:00
|
|
|
|
#pragma once
|
2023-04-01 03:18:41 +00:00
|
|
|
|
///@file
|
2021-10-25 13:53:01 +00:00
|
|
|
|
|
|
|
|
|
#include "error.hh"
|
|
|
|
|
#include "types.hh"
|
|
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The list of available experimental features.
|
|
|
|
|
*
|
2023-04-02 22:11:16 +00:00
|
|
|
|
* If you update this, don’t forget to also change the map defining
|
|
|
|
|
* their string representation and documentation in the corresponding
|
|
|
|
|
* `.cc` file as well.
|
2023-03-27 01:12:25 +00:00
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
enum struct ExperimentalFeature
|
|
|
|
|
{
|
|
|
|
|
CaDerivations,
|
2022-03-30 14:31:01 +00:00
|
|
|
|
ImpureDerivations,
|
2021-10-25 13:53:01 +00:00
|
|
|
|
Flakes,
|
|
|
|
|
NixCommand,
|
|
|
|
|
RecursiveNix,
|
2022-02-28 23:54:20 +00:00
|
|
|
|
NoUrlLiterals,
|
2022-03-24 20:33:20 +00:00
|
|
|
|
FetchClosure,
|
2022-05-20 12:20:00 +00:00
|
|
|
|
ReplFlake,
|
2022-02-28 23:54:20 +00:00
|
|
|
|
AutoAllocateUids,
|
2022-11-18 09:39:28 +00:00
|
|
|
|
Cgroups,
|
2023-04-17 13:41:39 +00:00
|
|
|
|
DaemonTrustOverride,
|
2023-04-17 23:02:45 +00:00
|
|
|
|
DynamicDerivations,
|
2023-06-09 09:53:18 +00:00
|
|
|
|
ParseTomlTimestamps,
|
2023-06-20 09:34:09 +00:00
|
|
|
|
ReadOnlyLocalStore,
|
2024-03-10 07:59:50 +00:00
|
|
|
|
ReplAutomation,
|
2021-10-25 13:53:01 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Just because writing `ExperimentalFeature::CaDerivations` is way too long
|
|
|
|
|
*/
|
|
|
|
|
using Xp = ExperimentalFeature;
|
|
|
|
|
|
2023-04-02 22:57:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* Parse an experimental feature (enum value) from its name. Experimental
|
|
|
|
|
* feature flag names are hyphenated and do not contain spaces.
|
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
const std::optional<ExperimentalFeature> parseExperimentalFeature(
|
|
|
|
|
const std::string_view & name);
|
2023-04-02 22:57:46 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show the name of an experimental feature. This is the opposite of
|
|
|
|
|
* parseExperimentalFeature().
|
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
std::string_view showExperimentalFeature(const ExperimentalFeature);
|
2023-04-02 22:57:46 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Shorthand for `str << showExperimentalFeature(feature)`.
|
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
std::ostream & operator<<(
|
|
|
|
|
std::ostream & str,
|
|
|
|
|
const ExperimentalFeature & feature);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-04-02 22:57:46 +00:00
|
|
|
|
* Parse a set of strings to the corresponding set of experimental
|
|
|
|
|
* features, ignoring (but warning for) any unknown feature.
|
2021-10-25 13:53:01 +00:00
|
|
|
|
*/
|
|
|
|
|
std::set<ExperimentalFeature> parseFeatures(const std::set<std::string> &);
|
|
|
|
|
|
2023-04-02 22:57:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* An experimental feature was required for some (experimental)
|
|
|
|
|
* operation, but was not enabled.
|
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
class MissingExperimentalFeature : public Error
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-04-02 22:57:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* The experimental feature that was required but not enabled.
|
|
|
|
|
*/
|
2021-10-25 13:53:01 +00:00
|
|
|
|
ExperimentalFeature missingFeature;
|
|
|
|
|
|
2023-04-02 22:57:46 +00:00
|
|
|
|
MissingExperimentalFeature(ExperimentalFeature missingFeature);
|
2021-10-25 13:53:01 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|