nix/tests/plugins/plugintest.cc

20 lines
455 B
C++
Raw Normal View History

2018-02-13 19:43:32 +00:00
#include "globals.hh"
#include "primops.hh"
using namespace nix;
2018-02-13 19:43:32 +00:00
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)
{
2018-02-13 19:43:32 +00:00
if (settingSet)
mkNull(v);
else
mkBool(v, false);
}
2018-02-13 19:43:32 +00:00
static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);