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