tvl-depot/third_party/nix/tests/plugins/plugintest.cc
Vincent Ambo 3652326ed2 refactor(3p/nix): Anchor local includes at src/
Previously all includes were anchored in one global mess of header
files. This moves the includes into filesystem "namespaces" (if you
will) for each sub-package of Nix.

Note: This commit does not introduce the relevant build system changes.
2020-05-27 21:56:34 +01:00

23 lines
564 B
C++

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