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