zb is an experiment in hermetic, reproducible build systems. It has not stabilized and should not be used for production purposes.
zb is based on the ideas in The purely functional software deployment model by Eelco Dolstra and Build systems à la carte, as well as the author's experience in working with build systems. The build model is mostly the same as in Nix, but build targets are configured in Lua instead of a domain-specific language.
The hello world example:
return derivation {
name = "hello";
infile = path "hello.txt";
builder = "/bin/sh";
system = "x86_64-linux";
args = {"-c", "while read line; do echo \"$line\"; done < $infile > $out"};
}
Other examples:
stage0-posix/x86_64-linux.lua
,
which uses the stage0-posix project
to build a minimal userspace (including a rudimentary C compiler).bootstrap.lua
,
which follows the live-bootstrap project steps
to build a more complete userspace.Prerequisites:
sudo mkdir /zb && sudo chown $(id -u):$(id -g) /zb
cd
into it.go build ./cmd/zb
./zb serve &
./zb build --file demo/hello.lua
You can use ./zb --help
to get more information on commands.
Must be running Windows 10 or later, since zb depends on Windows support for Unix sockets.
choco install mingw
.C:\zb
directory.cd
into it.go build .\cmd\zb
.\zb.exe serve
.\zb.exe build --file demo/hello_windows.lua
zb uses a slightly modified version of Lua 5.4.
The primary difference is that strings
(like those returned from the path
function
or the .out
field of a derivation)
can carry dependency information,
like in the Nix expression language.
This is largely hidden from the user.
From there, the following libraries are available:
table
modulepath
and derivation
.
These are intentionally similar to the Nix built-in functions.