zombiezen / zb

zombiezen build tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zombiezen build (zb) tool

zb is an experiment in hermetic, reproducible build systems. It is a prototype 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 the same as in Nix, but build targets are configured in Lua instead of a domain-specific language.

Examples

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:

Getting Started

  1. Install Nix (used as a temporary build backend, see Caveats below)
  2. go build ./cmd/zb
  3. ./zb build --file demo/hello.lua

You can use ./zb --help to get more information on commands.

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:

Objectives

Caveats

The following is a list of shortcuts taken for the zb prototype.

  • zb requires Nix to be installed. zb acts as a frontend over nix-store --realise to actually run the builds, but this dependency could be removed in the future.
  • zb was written in Go for speed of development. This makes self-hosting more complex, but there's nothing preventing a more production-ready implementation in C/C++.
  • The Lua next and pairs functions should sort keys to be deterministic.
  • Need to stabilize the Lua standard library that's available. string.format specifically would be good, but would require some fancy work to support the "context" dependency feature.
  • The stage0 demo is not entirely hermetic, since it uses the host's /bin/sh. Hypothetically, the demo could use the included kaem shell if kaem could support $out expansion.
  • The derivation built-in does not support the outputs parameter to declare multiple outputs.
  • In the demo directory, most all derivations are in a single file. A more full standard library would split up files.

License

MIT

About

zombiezen build tool

License:MIT License


Languages

Language:C 76.8%Language:Go 22.8%Language:Lua 0.3%Language:Shell 0.1%Language:Nix 0.1%