Initial commit
This commit is contained in:
commit
55a1efa08f
60 changed files with 5485 additions and 0 deletions
41
docs/modules/ROOT/pages/nixexpr.adoc
Normal file
41
docs/modules/ROOT/pages/nixexpr.adoc
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
= Nix expression support
|
||||
|
||||
When `(nix reader)` is imported, it is possible to execute Nix code inline with
|
||||
Scheme code. Simply wrap your Nix code in curly brackets:
|
||||
|
||||
[,scheme]
|
||||
----
|
||||
(write
|
||||
(string-append
|
||||
"Hello, Nix version"
|
||||
{ builtins.nixVersion }))
|
||||
----
|
||||
|
||||
The following values can be translated:
|
||||
|
||||
|===
|
||||
| Nix | Scheme | Notes
|
||||
|
||||
| string | string | (Loses string context.)
|
||||
| integer | number |
|
||||
| float | number |
|
||||
| boolean | boolean |
|
||||
| lambda | procedure | (with single argument)
|
||||
| list | vector or list | Depends on the status of `\*translate-list-as-vector*`
|
||||
| attrset | alist |
|
||||
| builtin | procedure |
|
||||
| external value | symbol, other unknown objects |
|
||||
|===
|
||||
|
||||
If a value in Nix is preceded with a comma, it is unquoted, similar to
|
||||
`(unquote)` in a Scheme quasiquotation. If prefixed with a single quote, it is
|
||||
`(quote)`-d.
|
||||
|
||||
[,scheme]
|
||||
----
|
||||
(define
|
||||
(test-append foo)
|
||||
(string-append "Hello, " foo))
|
||||
(write
|
||||
{ ,test-append "world!") })
|
||||
----
|
||||
Loading…
Add table
Add a link
Reference in a new issue