about summary refs log blame commit diff
path: root/tests/plugins/plugintest.cc
blob: 8da15ebabd7d0dcf3c0aac3db445b994c013401a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                     



                     




                                                         
                                                                                           
 



                         

 
                                                             
#include "globals.hh"
#include "primops.hh"

using namespace nix;

static BaseSetting<bool> settingSet{false, "setting-set",
        "Whether the plugin-defined setting was set"};

static RegisterSetting rs(&settingSet);

static void prim_anotherNull (EvalState & state, const Pos & pos, Value ** args, Value & v)
{
    if (settingSet)
        mkNull(v);
    else
        mkBool(v, false);
}

static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);