1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

Merge branch 'register-settings' of https://github.com/shlevy/nix

This commit is contained in:
Eelco Dolstra 2018-02-19 13:58:34 +01:00
commit 75a1d96cfd
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
8 changed files with 65 additions and 32 deletions

View file

@ -2,6 +2,6 @@ source common.sh
set -o pipefail
res=$(nix eval '(builtins.anotherNull)' --option plugin-files $PWD/plugins/libplugintest*)
res=$(nix eval '(builtins.anotherNull)' --option setting-set true --option plugin-files $PWD/plugins/libplugintest*)
[ "$res"x = "nullx" ]

View file

@ -1,10 +1,19 @@
#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)
{
mkNull(v);
if (settingSet)
mkNull(v);
else
mkBool(v, false);
}
static RegisterPrimOp r("anotherNull", 0, prim_anotherNull);
static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);