4.8 KiB
Bootstrap files
Currently nixpkgs builds most of its packages using bootstrap seed binaries (without the reliance on external inputs):
bootstrap-tools: an archive with the compiler toolchain and other helper tools enough to build the rest of thenixpkgs.- initial binaries needed to unpack
bootstrap-tools.*. Onlinuxit's justbusybox, ondarwinandfreebsdit isunpack.nar.xzwhich contains the binaries and script needed to unpack the tools. These binaries can be executed directly from the store.
These are called "bootstrap files".
Bootstrap files should always be fetched from Hydra and uploaded to tarballs.nixos.org to guarantee that all the binaries were built from the code committed into nixpkgs repository.
The uploads to tarballs.nixos.org are done by @NixOS/infra team members who have S3 write access.
This document describes the procedure of updating bootstrap files in nixpkgs.
How to upload bootstrap files (for infra team)
When a PR updates bootstrap files, the commit message contains the upload commands. Infra team members with S3 access can upload as follows:
-
Clone or navigate to the nixos-infra repository and enter the
terraformdirectory:$ cd nixos-infra/terraform -
Authenticate with AWS SSO:
$ aws sso login -
Realize the build output locally (fetch from hydra cache):
$ nix-store --realize /nix/store/<hash>-stdenv-bootstrap-tools -
Upload to S3 with public-read ACL:
$ aws s3 cp --recursive --acl public-read \ /nix/store/<hash>-stdenv-bootstrap-tools/on-server/ \ s3://nixpkgs-tarballs/stdenv/<target>/<nixpkgs-revision>/ -
Verify the upload by downloading and checking hashes:
$ aws s3 cp --recursive s3://nixpkgs-tarballs/stdenv/<target>/<nixpkgs-revision>/ ./ $ sha256sum bootstrap-tools.tar.xz busybox $ sha256sum /nix/store/<hash>-stdenv-bootstrap-tools/on-server/*Compare these hashes with those shown in the PR's commit message.
The exact paths and hashes are provided in each bootstrap update commit message generated by refresh-tarballs.bash.
How to request the bootstrap seed update
To get the tarballs updated let's use an example i686-unknown-linux-gnu target:
-
Create a local update:
$ maintainers/scripts/bootstrap-files/refresh-tarballs.bash --commit --targets=i686-unknown-linux-gnu -
Test the update locally. I'll build local
helloderivation with the result:$ nix-build -A hello --argstr system i686-linuxTo validate cross-targets
binfmtNixOShelper can be useful. Forriscv64-unknown-linux-gnuthe/etc/nixos/configuration.nixentry would beboot.binfmt.emulatedSystems = [ "riscv64-linux" ]. -
Propose the commit as a PR to update bootstrap tarballs, tag people who can help you test the updated architecture and once reviewed tag
@NixOS/infra-buildto upload the tarballs.
How to add bootstrap files for a new target
The procedure to add a new target is very similar to the update procedure.
The only difference is that you need to set up a new job to build the bootstrapFiles.
To do that you will need the following:
-
Add your new target to
lib/systems/examples.nixThis will populate
pkgsCross.$targetattribute set. If you are dealing withbootstrapFilesupload you probably already have it. -
Add your new target to
pkgs/stdenv/linux/make-bootstrap-tools-cross.nix. This will add a new hydra job tonixpkgs:cross-trunkjobset. -
Wait for a Hydra to build your bootstrap tarballs.
-
Add your new target to
maintainers/scripts/bootstrap-files/refresh-tarballs.basharoundCROSS_TARGETS=(). -
Add your new target to
pkgs/stdenv/linux/default.nixand follow standard bootstrap seed update procedure above.
Bootstrap files job definitions
There are two types of bootstrap files:
-
natively built
stdenvBootstrapTools.buildHydra jobs innixpkgs:trunkjobset. Incomplete list of examples is:aarch64-unknown-linux-musl.nixi686-unknown-linux-gnu.nix
These are Tier 1 Hydra platforms.
-
cross-built by
bootstrapTools.buildHydra jobs innixpkgs:cross-trunkjobset. Incomplete list of examples is:mips64el-unknown-linux-gnuabi64.nixmips64el-unknown-linux-gnuabin32.nixmipsel-unknown-linux-gnu.nixpowerpc64le-unknown-linux-gnu.nixriscv64-unknown-linux-gnu.nix
These are usually Tier 2 and lower targets.
The .build job contains /on-server/ subdirectory with binaries to be uploaded to tarballs.nixos.org.
The files are uploaded to tarballs.nixos.org by writers to S3 store.