1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00
nix/tests/functional/plugins/plugintest.cc
John Ericson b0e198cd03 WIP get settings info out of headers, out of libutil
Also make a tiny bit of progress on libstore
2025-05-21 17:59:18 -04:00

28 lines
594 B
C++

#include "nix/main/config-global.hh"
#include "nix/expr/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 PosIdx pos, Value ** args, Value & v)
{
if (mySettings.settingSet)
v.mkNull();
else
v.mkBool(false);
}
static RegisterPrimOp rp({
.name = "anotherNull",
.arity = 0,
.fun = prim_anotherNull,
});