mirror of
https://github.com/NixOS/nix
synced 2025-07-02 09:21:47 +02:00
Add feature to disable URL literals
E.g. $ nix-build '<nixpkgs>' -A hello --experimental-features no-url-literals error: URL literals are disabled, at /nix/store/vsjamkzh15r3c779q2711az826hqgvzr-nixpkgs-20.03pre194957.bef773ed53f/nixpkgs/pkgs/top-level/all-packages.nix:1236:11 Helps with implementing https://github.com/NixOS/rfcs/pull/45.
This commit is contained in:
parent
fc62caa4a5
commit
1ec6e6e11e
3 changed files with 16 additions and 3 deletions
|
@ -105,10 +105,15 @@ StringSet Settings::getDefaultSystemFeatures()
|
|||
return features;
|
||||
}
|
||||
|
||||
void Settings::requireExperimentalFeature(const std::string & name)
|
||||
bool Settings::isExperimentalFeatureEnabled(const std::string & name)
|
||||
{
|
||||
auto & f = experimentalFeatures.get();
|
||||
if (std::find(f.begin(), f.end(), name) == f.end())
|
||||
return std::find(f.begin(), f.end(), name) != f.end();
|
||||
}
|
||||
|
||||
void Settings::requireExperimentalFeature(const std::string & name)
|
||||
{
|
||||
if (!isExperimentalFeatureEnabled(name))
|
||||
throw Error("experimental Nix feature '%s' is disabled", name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue