Add experimental-features setting
Experimental features are now opt-in. There is currently one
experimental feature: "nix-command" (which enables the "nix"
command. This will allow us to merge experimental features more
quickly, without committing to supporting them indefinitely.
Typical usage:
$ nix build --experimental-features 'nix-command flakes' nixpkgs#hello
(cherry picked from commit 8e478c2341
,
without the "flakes" feature)
This commit is contained in:
parent
389a2cebed
commit
aabf5c86c9
4 changed files with 15 additions and 0 deletions
|
@ -105,6 +105,13 @@ StringSet Settings::getDefaultSystemFeatures()
|
|||
return features;
|
||||
}
|
||||
|
||||
void Settings::requireExperimentalFeature(const std::string & name)
|
||||
{
|
||||
auto & f = experimentalFeatures.get();
|
||||
if (std::find(f.begin(), f.end(), name) == f.end())
|
||||
throw Error("experimental Nix feature '%s' is disabled", name);
|
||||
}
|
||||
|
||||
const string nixVersion = PACKAGE_VERSION;
|
||||
|
||||
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
||||
|
|
|
@ -353,6 +353,11 @@ public:
|
|||
|
||||
Setting<Paths> pluginFiles{this, {}, "plugin-files",
|
||||
"Plugins to dynamically load at nix initialization time."};
|
||||
|
||||
Setting<Strings> experimentalFeatures{this, {}, "experimental-features",
|
||||
"Experimental Nix features to enable."};
|
||||
|
||||
void requireExperimentalFeature(const std::string & name);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -138,6 +138,8 @@ void mainWrapped(int argc, char * * argv)
|
|||
|
||||
args.parseCmdline(argvToStrings(argc, argv));
|
||||
|
||||
settings.requireExperimentalFeature("nix-command");
|
||||
|
||||
initPlugins();
|
||||
|
||||
if (!args.command) args.showHelpAndExit();
|
||||
|
|
|
@ -17,6 +17,7 @@ cat > "$NIX_CONF_DIR"/nix.conf <<EOF
|
|||
build-users-group =
|
||||
keep-derivations = false
|
||||
sandbox = false
|
||||
experimental-features = nix-command
|
||||
include nix.conf.extra
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Reference in a new issue