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