- `fun` was used for variable/field names in a number of places. These have been replaced by similar or more descriptive names, to avoid name shadowing, which is not allowed in the GCC-based build. - Use in-place construction instead of assignment. - `FilteringSourceAccessor::checkAccess` had a fallback for when `makeNotAllowedError` was null. Since `MakeNotAllowedError` is now `fun<>`, we've proven the null branch is dead code and have removed it. - `src/nix/flake.cc`, `src/nix/search.cc`, `src/nix/ls.cc` are left as-is — the self-referential lambdas there cause too much reindentation for too little benefit.
28 lines
586 B
C++
28 lines
586 B
C++
#include "nix/util/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,
|
|
.impl = prim_anotherNull,
|
|
});
|