Allow plugins to define new settings.

This commit is contained in:
Shea Levy 2018-02-13 14:43:32 -05:00
parent 3fe9767dd3
commit de4934ab3b
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
8 changed files with 65 additions and 32 deletions

View file

@ -1,10 +1,19 @@
#include "globals.hh"
#include "primops.hh"
using namespace nix;
static BaseSetting<bool> settingSet{false, "setting-set",
"Whether the plugin-defined setting was set"};
static RegisterSetting rs(&settingSet);
static void prim_anotherNull (EvalState & state, const Pos & pos, Value ** args, Value & v)
{
mkNull(v);
if (settingSet)
mkNull(v);
else
mkBool(v, false);
}
static RegisterPrimOp r("anotherNull", 0, prim_anotherNull);
static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);