DevelopersBuild and test

Bootstrap a release

Build the compilers of Liana's Linux release from a seed of a few hundred bytes, and the C compilers of its macOS and Windows builds.

Your machine builds the compilers before it builds Liana. How far down that goes depends on the tool that builds each release file:

Release filesBuilt withRebuilt from the seedTaken as a binary
Linux, x86_64GuixGCC, Rust, Cargo and ZigNothing above the seeds, the static tools and your Guix installation
WindowsNixGCC, the C library and the MinGW-w64 cross-compilerRust 1.88.0, and the Rust 1.97.1 that starts nixpkgs' own Rust
macOSNixGCC and the C libraryThe same two, a compiled stage of Zig, the Go 1.24.13 that starts nixpkgs' own Go, Apple's Xcode 12.2 SDK
Two staircases start from a green hex0-seed. The Guix line climbs unbroken through GNU Mes, TinyCC, four GCC versions, mrustc, Rust and Zig to Liana's Linux binaries. The Nix line is rebuilt only up to the C compiler, plus MinGW-w64 for Windows. Pre-built Rust 1.88.0 and Rust 1.97.1 join it for Liana on Windows and on macOS, with zig1.wasm, Go 1.24.13 and the Xcode 12.2 SDK for macOS only.
Guix rebuilds every compiler of the Linux build from its seed. Nix rebuilds the C compilers and takes Rust pre-built, plus a stage of Zig, Go and Apple's SDK for macOS.

You will need

  • An x86_64 Linux machine: A computer or virtual machine where Guix and Nix have never downloaded a pre-built package. Both reuse what they already hold, so they do not rebuild a package they downloaded earlier.

  • Memory: More than 10 GB, because linking Zig takes up to 10 GB.

  • Time: Many hours. After the first GCC, 2.95.3, come 20 Rust compilers, 70 Zig builds and seven versions of LLVM.

  • The signed source: liana/ checked out at v16.0, with the hash list in published/, as in Get the signed source and hash list.

  • Guix, with substitutes refused: Follow Install Guix, and refuse when the installer asks to download pre-built packages. Before the guix pull of that step, run this command:

    cat /etc/guix/acl

    Check that it prints No such file or directory. With no substitutes, that guix pull builds the latest Guix from the seed first, through the same stages.

  • Nix: For the macOS and Windows files, follow Set up Nix for macOS and Windows.

Not ready to spend the build time?

Reproduce a release gets the published bytes with compilers that Guix and Nix download pre-built. The first step of Compare the toolchain with the build farms then checks that two build farms publish the same compilers, and builds nothing.

Bootstrap the Linux toolchain with Guix

Run every command from liana/. Each step builds one stage, and that stage compiles the next one. The first stages, from the seed to GCC 2.95.3, are Guix's full-source bootstrap. If a build stops, run the same command again. Guix keeps every stage it has finished. The versions below are those of Liana 16.0.

Check that Guix trusts no build farm

cat /etc/guix/acl

After a refusal, the file does not exist, and cat prints No such file or directory. Guix accepts a pre-built package only if a key in this file signed it. If the file lists the public-key of a build farm, Guix may already hold pre-built packages, and it does not rebuild them. Start again on a machine where Guix never ran.

Pin Guix to the commit of the release

COMMIT=$(grep -o -- '--commit=[0-9a-f]*' \
  contrib/reproducible/guix/guix-build.sh | cut -d= -f2)
pinned() {
  guix time-machine --url=https://codeberg.org/guix/guix.git \
    --commit="$COMMIT" -- "$@"
}
echo "$COMMIT"
Expected output
0d622898faee0f3119a6878a23bcbcc817afec12

The build script runs Guix at one fixed commit. pinned runs any Guix command at that commit, so each stage below is the one the release build uses. In a new shell, run this block again.

Build the C toolchain from the seed

pinned describe

Guix cannot run at the pinned commit before it has built itself there. With no substitutes, that build starts at the seed, and reuses each stage that guix pull built from the same recipe. Guix prints building /gnu/store/<hash>-<name>.drv... when it starts each of these stages, and each stage compiles the next:

StageWhat Guix builds
SeedsDownloads a static Guile 2.0.9, four static tools that unpack it, a set of static tools that patch sources, an archive of Linux kernel headers, and the sources of the later stages
stage0-posix-1.6.0From the 256-byte hex0-seed up to M2-Planet, a compiler for a subset of C
mes-boot-0.25.1GNU Mes: a Scheme interpreter, and MesCC, a C compiler written in Scheme
tcc-boot-0.9.27TinyCC, through a patched TinyCC that MesCC can compile
gcc-mesboot0-2.95.3GCC 2.95.3, the most recent that the C library of Mes supports, then glibc 2.2.5
gcc-mesboot-4.9.4GCC 4.6.4, then glibc 2.16.0 and GCC 4.9.4
gcc-14.3.0GCC 14.3.0, the last compiler of the chain, on the glibc 2.41 of your Guix installation
guix-0d622898fGuile 3.0 and the libraries of Guix, then Guix at the pinned commit

The first stages are slow: a shell written in Scheme runs their build scripts.

Guix also prints substitute: looking for substitutes on and the address of a build farm. It asks each farm what it holds. With no key in /etc/guix/acl, it downloads none of it. The command ends with the commit:

End of the expected output
  guix 0d62289
    repository URL: https://codeberg.org/guix/guix.git
    commit: 0d622898faee0f3119a6878a23bcbcc817afec12

Check each stage of the C toolchain

for stage in stage0-posix mes-boot tcc-boot gcc-mesboot0 gcc-mesboot gcc-final; do
  pinned build --no-grafts -e "(@@ (gnu packages commencement) $stage)"
done

Guix builds a stage only if your store does not hold it yet, then prints its folder. --no-grafts asks for each package as the chain built it, before Guix applies security updates to it. <hash> stands for 32 characters that Guix derives from the inputs of a build, the same on every machine that runs the pinned commit.

Expected output
/gnu/store/<hash>-stage0-posix-1.6.0
/gnu/store/<hash>-mes-boot-0.25.1
/gnu/store/<hash>-tcc-boot-0.9.27
/gnu/store/<hash>-gcc-mesboot0-2.95.3
/gnu/store/<hash>-gcc-mesboot-4.9.4
/gnu/store/<hash>-gcc-14.3.0-lib
/gnu/store/<hash>-gcc-14.3.0

Rebuild the libraries that came with Guix

Your Guix installation came with a compiled glibc 2.41 and GCC 14.3.0 runtime library, and Guix reuses them as they are. Compile glibc again and compare it with the one in your store:

pinned build --check --no-grafts --keep-failed \
  -e '(@@ (gnu packages commencement) glibc-final)'

If your bytes match the ones in your store, the command ends with the three store paths of glibc:

End of the expected output
/gnu/store/<hash>-glibc-2.41-debug
/gnu/store/<hash>-glibc-2.41
/gnu/store/<hash>-glibc-2.41-static

Then compile GCC again:

pinned build --check --no-grafts --keep-failed \
  -e '(@@ (gnu packages commencement) gcc-final)'
End of the expected output
/gnu/store/<hash>-gcc-14.3.0-lib
/gnu/store/<hash>-gcc-14.3.0

If the bytes differ, Guix stops with an error and keeps your build in /gnu/store, under a name that ends in -check.

Build the first Rust compiler with mrustc

pinned build -e '(@ (gnu packages rust) rust-bootstrap-1.74)'

GCC compiles LLVM 17 and mrustc, a Rust compiler written in C++. Guix takes a snapshot of mrustc that follows version 0.11.2. mrustc compiles Rust 1.74.0. Guix's package definition gives its build farms up to 36 hours for this build.

End of the expected output
/gnu/store/<hash>-rust-1.74.0-cargo
/gnu/store/<hash>-rust-1.74.0

Build Rust and Cargo

pinned build rust

Rust 1.74.0 compiles Rust 1.75, and each release compiles the next, through 18 releases up to Rust 1.92. Rust 1.92 compiles Rust 1.93.0 and Cargo, which the release build uses, and runs their test suite. That makes 19 compilers after the one from mrustc, with LLVM 19 and LLVM 21 on the way.

End of the expected output
/gnu/store/<hash>-rust-1.93.0-cargo
/gnu/store/<hash>-rust-1.93.0
/gnu/store/<hash>-rust-1.93.0-rust-src
/gnu/store/<hash>-rust-1.93.0-tools

Build Zig

pinned build zig

Guix deletes the compiled zig1.wasm from Zig's source. It starts from a snapshot of Zig 0.10 whose compiler it restores in C++, and Zig 0.15.2 is the 70th build. These builds need six versions of LLVM, from 15 to 20.

End of the expected output
/gnu/store/<hash>-zig-0.15.2
/gnu/store/<hash>-zig-0.15.2-zig1

Build the other packages of the release build

pinned build -m contrib/reproducible/guix/manifest.scm

Guix builds what remains of the build container, among them cargo-zigbuild and patchelf.

Build Liana and compare

Follow Install Rust, Run the Guix build and Compare with the published archive. Guix holds every package of the container, so the script builds only the profile that joins them, then compiles Liana. The hashes of your three binaries must match the published ones.

Bootstrap the macOS and Windows C toolchain with Nix

Nix rebuilds the C side of these builds from the seed, with the minimal-bootstrap packages of nixpkgs. It takes Rust as a binary and, for macOS, other compilers too, as Review what the build still trusts lists. Run every command from liana/. A source download can fail at any step. The versions below are those of Liana 16.0.

Read the nixpkgs revision of the release

REV=$(nix eval --raw --impure --expr \
  '(builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked.rev')
NIXPKGS="github:NixOS/nixpkgs/$REV"
from_source() {
  nix build --option substitute false --no-link --print-out-paths "$@"
}
echo "$NIXPKGS"
Expected output
github:NixOS/nixpkgs/c043004d1c6985732bcc1cbc5a9c9aecbbb4e0f0

flake.lock pins the nixpkgs revision that defines the C toolchain of the build. from_source builds a package of that revision and prints its folder. --option substitute false makes Nix build instead of downloading from cache.nixos.org. In a new shell, run this block again.

Fetch the stage0-posix sources

nix build --no-link --print-out-paths "$NIXPKGS#minimal-bootstrap.stage0-posix.src"

This source tree is the one path that Nix cannot download by itself this early. nixpkgs pins its hash and takes it from the cache. It holds no compiled file.

Expected output
/nix/store/<hash>-stage0-posix-1.9.1-source

Build hex0 from the seed

sha256sum $(from_source \
  "$NIXPKGS#minimal-bootstrap.stage0-posix.hex0-seed" \
  "$NIXPKGS#minimal-bootstrap.stage0-posix.hex0")

Nix downloads the 229-byte hex0-seed, then has it assemble hex0 from commented hexadecimal. The two hashes must be identical: the seed has rebuilt itself from its source.

Expected output
<hash>  /nix/store/<hash>-hex0-seed
<hash>  /nix/store/<hash>-hex0-1.9.1

Build GNU Mes

from_source "$NIXPKGS#minimal-bootstrap.mes.compiler"

hex0 assembles the stage0-posix tools up to M2-Planet. M2-Planet compiles a first GNU Mes 0.27.1, which compiles the final one.

Expected output
/nix/store/<hash>-mes-0.27.1

Build TinyCC

from_source "$NIXPKGS#minimal-bootstrap.tinycc-mes.compiler"

MesCC compiles a patched TinyCC, which compiles a recent TinyCC.

Expected output
/nix/store/<hash>-tinycc-mes-unstable-2025-12-03

Build the first GCC

from_source "$NIXPKGS#minimal-bootstrap.gcc46"

TinyCC compiles the musl C library, a set of basic tools, then GCC 4.6.4.

Expected output
/nix/store/<hash>-gcc-4.6.4

Build the modern GCC and glibc

from_source "$NIXPKGS#minimal-bootstrap.gcc-glibc" "$NIXPKGS#minimal-bootstrap.glibc"

GCC 4.6.4 compiles GCC 10.4.0, which compiles GCC 15.3.0. That compiler builds glibc 2.42, then a second GCC 15.3.0 that uses glibc.

Expected output
/nix/store/<hash>-gcc-15.3.0
/nix/store/<hash>-glibc-2.42

Build the compiler that nixpkgs uses

from_source "$NIXPKGS#stdenv.cc"

nixpkgs rebuilds GCC and its tools several times with themselves, until no package depends on a bootstrap stage.

Expected output
/nix/store/<hash>-gcc-wrapper-15.3.0-man
/nix/store/<hash>-gcc-wrapper-15.3.0

Build a release file

nix build --option substitute false .#liana.x86_64-pc-windows-gnu

Nix builds the MinGW-w64 cross-compiler with the GCC of the step before. It downloads the Rust 1.88.0 binaries, and a Rust 1.97.1 binary that compiles nixpkgs' own Rust for a helper tool. Then it compiles liana-gui.exe. After the step before, about 2,200 derivations remain, most of them downloads of Rust libraries. When it ends, compare the file with the signed hash.

The macOS targets of Rebuild the macOS binaries take the same option, once the SDK is in the Nix store.

List what Nix took from the cache

nix-store --query --requisites --include-outputs \
  "$(nix path-info --derivation .#liana.x86_64-pc-windows-gnu)" \
  | grep -v '\.drv$' | xargs nix path-info --sigs | grep cache.nixos.org

The command prints every path of the build that cache.nixos.org signed, one per line. It must print only what you took from the cache by hand: the stage0-posix sources, any other source, and tzdata.

First line of the expected output
/nix/store/<hash>-stage0-posix-1.9.1-source  ca:fixed:r:sha256:<hash> cache.nixos.org-1:<signature>

Compare the toolchain with the build farms

guix challenge compares the hash of each package you built with the hash that the two Guix build farms publish. For a package you downloaded, it compares the two farms with each other. The farms build on separate machines, with different build software, from the same Guix source.

Compare Rust, Cargo and Zig with both farms

Define pinned as in Pin Guix to the commit of the release, then run:

pinned challenge rust rust:cargo zig \
  --substitute-urls="https://bordeaux.guix.gnu.org https://ci.guix.gnu.org"

After the bootstrap, Guix compares your own builds with both farms. On a Guix that accepted substitutes, it compares the farms with each other, and your store plays no part. The command ends with a count:

End of the expected output
3 store items were analyzed:
  - 3 (100.0%) were identical
  - 0 (0.0%) differed
  - 0 (0.0%) were inconclusive

If a package differs, Guix lists it above the count with the hash from each farm, and with your hash if you built it. A build that is not reproducible also differs, so a difference is a lead, not a proof of tampering. The release build uses the package in your store either way.

Rebuild Rust and compare it with the one you downloaded

On a Guix that accepted substitutes, after Run the Guix build has downloaded Rust, run:

pinned build --check --no-grafts --keep-failed rust

Guix first prints The following derivations will be built: and a long list that names the earlier Rust compilers. It builds only rust-1.93.0.drv, and downloads the inputs that build needs, among them Rust 1.92.0. Guix compiles Rust again from these inputs, then runs its test suite. --no-grafts makes it recompile the package itself.

If your bytes match the ones in your store, the command ends with the four store paths of Rust:

End of the expected output
/gnu/store/<hash>-rust-1.93.0-cargo
/gnu/store/<hash>-rust-1.93.0
/gnu/store/<hash>-rust-1.93.0-rust-src
/gnu/store/<hash>-rust-1.93.0-tools

If they differ, Guix stops with an error and keeps your build in /gnu/store, under a name that ends in -check.

Review what the build still trusts

A bootstrap removes from what you trust the compilers it rebuilds. These inputs remain:

InputGuix build of the Linux filesNix build of the macOS and Windows files
Seed programshex0-seed (256 bytes) and kaem-optional-seed (640 bytes)hex0-seed (229 bytes)
Binaries that drive the first buildsA static Guile 2.0.9 (12 MiB), and static bash, tar, xz and mkdir that unpack it. Also 115 static programs (92 MiB), among them tar, xz and patch, that patch and repack the sources of 18 packages of the chain, such as GCC 4.9.4, GCC 14.3.0 and glibc 2.41. An archive of Linux kernel headers comes ready-made tooNone: hex0-seed runs the first build itself. The Nix sandbox adds a BusyBox shell as /bin/sh
Compilers taken as binariesNoneRust 1.88.0 from the Rust project, and the Rust 1.97.1 that starts nixpkgs' own Rust. For macOS, also Zig's zig1.wasm, the Go 1.24.13 that starts nixpkgs' own Go, and Apple's Xcode 12.2
The package managerThe Guix you installed. The Guix 1.5.0 installer ships a compiled glibc 2.41 and GCC runtime library. Every package that GCC 14.3.0 and the later compilers build links against them. Guix reuses them as they are, and one step rebuilds them to compareThe Nix you installed
Taken from cache.nixos.orgNothingThe stage0-posix sources, each source whose download failed, and tzdata-2026c if its test failed
Rust librariesThe cargo that downloads them before the build container startsNix downloads them and checks each hash
Your machineIts kernel and its hardwareIts kernel and its hardware

The Reproducible builds page explains what stays outside the chain.

Next steps