aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-06-16 04:04:20 +0000
committerGerrit Code Review <gerrit@localhost>2024-06-16 04:04:20 +0000
commitb4035ed1d19a2a77a775a65c3c7af125007dae2a (patch)
treeb26719954f81344478b084ddf4162d53aa486227
parent4734ce7831daf6e7e976029017b1cc2e7e615f30 (diff)
parent194b6cc6116ce55cf0ca028c577afd9b6f8bce42 (diff)
Merge "docs: expand importNative/exec example (#10803)" into main
-rw-r--r--src/libexpr/eval-settings.hh16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh
index 6282579a9..cd73d195f 100644
--- a/src/libexpr/eval-settings.hh
+++ b/src/libexpr/eval-settings.hh
@@ -15,9 +15,21 @@ struct EvalSettings : Config
static std::string resolvePseudoUrl(std::string_view url);
Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation", R"(
- Whether builtin functions that allow executing native code should be enabled.
+ Enable built-in functions that allow executing native code.
- In particular, this adds the `importNative` and `exec` builtins.
+ In particular, this adds:
+ - `builtins.importNative` *path* *symbol*
+
+ Runs function with *symbol* from a dynamic shared object (DSO) at *path*.
+ This may be used to add new builtins to the Nix language.
+ The procedure must have the following signature:
+ ```cpp
+ extern "C" typedef void (*ValueInitialiser) (EvalState & state, Value & v);
+ ```
+
+ - `builtins.exec` *arguments*
+
+ Execute a program, where *arguments* are specified as a list of strings, and parse its output as a Nix expression.
)"};
Setting<Strings> nixPath{