2018-03-27 19:41:31 +03:00
|
|
|
#include "config.hh"
|
2018-02-08 18:26:18 +02:00
|
|
|
#include "primops.hh"
|
|
|
|
|
|
|
|
using namespace nix;
|
|
|
|
|
2018-03-27 19:41:31 +03:00
|
|
|
struct MySettings : Config
|
|
|
|
{
|
|
|
|
Setting<bool> settingSet{this, false, "setting-set",
|
2018-02-13 21:43:32 +02:00
|
|
|
"Whether the plugin-defined setting was set"};
|
2018-03-27 19:41:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
MySettings mySettings;
|
2018-02-13 21:43:32 +02:00
|
|
|
|
2018-03-27 19:41:31 +03:00
|
|
|
static GlobalConfig::Register rs(&mySettings);
|
2018-02-13 21:43:32 +02:00
|
|
|
|
2018-02-08 20:00:53 +02:00
|
|
|
static void prim_anotherNull (EvalState & state, const Pos & pos, Value ** args, Value & v)
|
2018-02-08 18:26:18 +02:00
|
|
|
{
|
2018-03-27 19:41:31 +03:00
|
|
|
if (mySettings.settingSet)
|
2018-02-13 21:43:32 +02:00
|
|
|
mkNull(v);
|
|
|
|
else
|
|
|
|
mkBool(v, false);
|
2018-02-08 18:26:18 +02:00
|
|
|
}
|
|
|
|
|
2018-02-13 21:43:32 +02:00
|
|
|
static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);
|