diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2024-05-29 09:50:51 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2024-05-30 08:12:03 +0200 |
commit | 194b6cc6116ce55cf0ca028c577afd9b6f8bce42 (patch) | |
tree | 496bc11417f3fc5cb983c41bf8a5ed702903ce90 /src/libexpr/eval-settings.hh | |
parent | 71b32bb87cd48dbbd672c8ca6b041ed36f3bae11 (diff) |
docs: expand importNative/exec example (#10803)
Co-authored-by: Qyriad <qyriad@qyriad.me>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
(cherry picked from commit 5786e1ae7c300b3c7434e7df99b41f180dc42e37)
Change-Id: I16b408ba7c70dca985c05c71bf6195fe9f0b5841
Diffstat (limited to 'src/libexpr/eval-settings.hh')
-rw-r--r-- | src/libexpr/eval-settings.hh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh index 4674acda2..e4a9eb7fc 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{ |