tvl-depot/third_party/nix/tests/plugins/plugintest.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
564 B
C++
Raw Normal View History

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