aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/fromTOML.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-06-14 20:32:37 +0200
committerGitHub <noreply@github.com>2023-06-14 20:32:37 +0200
commite377746842c1ae07dd6c4fdf6aa7eb0002b5cdcf (patch)
tree24c8491128d34fd0313d4083aad0b5ef5992aea5 /src/libexpr/primops/fromTOML.cc
parent468add5aa0b5b0a686cd07aa5417817bb8799602 (diff)
parentc6d7c4f9ecb919cced435cf179d8ece5d25b5f06 (diff)
Merge pull request #8491 from wentasah/builtins-doc
Document several undocumented builtin functions
Diffstat (limited to 'src/libexpr/primops/fromTOML.cc')
-rw-r--r--src/libexpr/primops/fromTOML.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libexpr/primops/fromTOML.cc b/src/libexpr/primops/fromTOML.cc
index e2a8b3c3a..2f4d4022e 100644
--- a/src/libexpr/primops/fromTOML.cc
+++ b/src/libexpr/primops/fromTOML.cc
@@ -90,6 +90,24 @@ static void prim_fromTOML(EvalState & state, const PosIdx pos, Value * * args, V
}
}
-static RegisterPrimOp primop_fromTOML("fromTOML", 1, prim_fromTOML);
+static RegisterPrimOp primop_fromTOML({
+ .name = "fromTOML",
+ .args = {"e"},
+ .doc = R"(
+ Convert a TOML string to a Nix value. For example,
+
+ ```nix
+ builtins.fromTOML ''
+ x=1
+ s="a"
+ [table]
+ y=2
+ ''
+ ```
+
+ returns the value `{ s = "a"; table = { y = 2; }; x = 1; }`.
+ )",
+ .fun = prim_fromTOML
+});
}