Initial commit

This commit is contained in:
puck 2024-10-03 23:57:22 +00:00
commit 55a1efa08f
60 changed files with 5485 additions and 0 deletions

View file

@ -0,0 +1,32 @@
* xref:index.adoc[]
* xref:nixexpr.adoc[]
* xref:zexp.adoc[]
* ++(zilch)++
** xref:generated:zilch.file.adoc[++(zilch file)++]
** xref:generated:zilch.magic.adoc[++(zilch magic)++]
** xref:generated:zilch.nixpkgs.adoc[++(zilch nixpkgs)++]
** xref:generated:zilch.statusbar.adoc[++(zilch statusbar)++]
** xref:generated:zilch.zexpr.adoc[++(zilch zexpr)++]
* ++(zilch lang go)++
** xref:generated:zilch.lang.go.adoc[++(zilch lang go)++]
** xref:generated:zilch.lang.go.core.adoc[++(zilch lang go core)++]
** xref:generated:zilch.lang.go.fetch.adoc[++(zilch lang go fetch)++]
** xref:generated:zilch.lang.go.mod.adoc[++(zilch lang go mod)++]
** xref:generated:zilch.lang.go.package.adoc[++(zilch lang go package)++]
** xref:generated:zilch.lang.go.stdlib.adoc[++(zilch lang go stdlib)++]
** xref:generated:zilch.lang.go.sum.adoc[++(zilch lang go sum)++]
** xref:generated:zilch.lang.go.version.adoc[++(zilch lang go version)++]
** xref:generated:zilch.lang.go.vfs.adoc[++(zilch lang go vfs)++]
* ++(zilch lib)++
** xref:generated:zilch.lib.getopt.adoc[++(zilch lib getopt)++]
** xref:generated:zilch.lib.hash.adoc[++(zilch lib hash)++]
** ++(zilch nix)++
*** xref:generated:zilch.nix.binproto.adoc[++(zilch nix binproto)++]
*** xref:generated:zilch.nix.daemon.adoc[++(zilch nix daemon)++]
*** xref:generated:zilch.nix.drv.adoc[++(zilch nix drv)++]
*** xref:generated:zilch.nix.hash.adoc[++(zilch nix hash)++]
*** xref:generated:zilch.nix.path.adoc[++(zilch nix path)++]
* xref:architecture.adoc[]

View file

@ -0,0 +1,11 @@
= Architecture
`(zilch nix binproto)` contains an implementation of the binary protocol used both
to talk to the daemon and to build NAR files.
On top of that is `(zilch nix daemon)`, which implements a version (which?) of
the Nix worker protocol.
`(zilch nix drv)` allows reading and writing .drv objects.
`(zilch nix path)` contains the helpers for building store paths of various types.

View file

@ -0,0 +1,22 @@
= Introduction
Zilch is an experimental testbed for implementing reproducible compilation
technologies, based on Nix, but steering clear of most of the parts of Nix
built on top of the derivation concept.
Like Guix, it is built on top of Scheme. However, unlike Guix, it does not
require a second, incompatible Nix-like daemon to be installed.
Features:
* Solid, reusable, Nix daemon protocol core
* Batteries included
* Intercompatible with Nixpkgs and other, arbitrary, Nix expressions.
== Current work
Current effort in Zilch is working on making "incremental", bitesize,
derivations to work. This is currently being implemented for Go.
== Contributing
Come join [.line-through]#us# me at `#zilch` on https://libera.chat[libera.chat]!

View 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!") })
----

View file

@ -0,0 +1,28 @@
= zexps
zexps, similar to g-expressions in Guix, are a way to generate
S-expressions that are taggged with store paths. But that's where
the similarity ends.
To create a zexp, you can use either the full syntax, or the reader macro:
[,scheme]
----
#~(foo bar #$baz)
; is identical to:
(zexp (foo bar (zexp-unquote baz)))
----
`(zexp-unquote VAL)` returns the value that the zexp (or any compatible record)
contains, while gathering the `zexp-unquote`d values used.
Like quasiquotation, zexps can use `unquote`, including ``zexp-unquote``d values
inside the ``unquote``d code. ``unquote``d code is evaluated when the `zexp` is evaluated.
[,scheme]
----
(define world #~,(begin (write "hello") "world"))
(define hello #~("hello" ,(string-append "very " "cute") #$world))
; When hello is used as zexp, it will also write "hello" to the output port.
----