Open siraben opened 3 years ago
This is by no means complete, but I have been able to build several of the base tools for live-bootstrap using Nix, see https://github.com/siraben/mes-overlay/tree/master/pkgs
A good reason to do this too is that a smaller bootstrap seed could be stored in nixpkgs itself instead of requiring someone (presumably with special permissions) to host a new binary bootstrap tarball.
Here are few risks:
Support for other architectures (riscv is prob not supported, not sure bout arm)
The same project also has the ARM bootstrap WIP, see for instance the seeds.
For more exotic stuff like osx/windows/bsd we would still rely on the same tarballs?
Indeed, this just for Linux bootstrap, but shouldn't affect the others much, since we separate stdenvs anyway.
There is a lot of work involved to bootstrap something, reproducibility probably would be a pain
The bootstrappable people put a lot of emphasis on reproducibility for their stages (up to and not including GCC), so I think this would help.
EDIT: for now, only the x86-linux bootstrap is demonstrably mature enough to be a viable replacement for our current tarball
Right no even x86-linux bootstrap in live-bootstrap project is probably not mature enough, but it's getting there. live-bootstrap can reproducibly bootstrap GCC 4.0.4 (C only) without using any pre-generated stuff (bison parsers, configure scripts from autotools, etc...). But we don't yet have newer GCC with C++.
Other arches are indeed less advanced. But that's probably not important, can do each arch separately.
And there are two choices: 1) Integrate it inside nixpks. 2) Build a bit of scripting on top of live-bootstrap to reproducibly create stdenv tarball.
If anybody interested, i had my own take on doing this (this is not production ready code, just an experiment) - we can build at least until M2-planet - without using stdenv/bash from host, just by using kaem-optional-seed as builder, generate script for it using nix and go from there.
See results and raw derivation
Problems are:
From there - we have derivation which produces executables which can:
nix can be used to generate different flavors of kaem scripts for each of arch.
For me questions are:
Reading materials:
There is some progress.
https://www.freelists.org/post/bootstrappable/GNU-Mes-024-released https://www.freelists.org/post/bootstrappable/stage0posix-M2Planet-release https://issues.guix.gnu.org/55227
See also this effort: https://github.com/andrewchambers/trusting-trust/
That was discussed in https://matrix.to/#/#bootstrappable:libera.chat
Very exciting stuff!
A cheap way for us to achieve a verifiable bootstrap seed would be to use GUIX to generate it. That might be less work than implementing full source bootstrap in nixpkgs. It can be replaced later.
This seem to be used to generate the bootstrap-tools in bootstrap-files/x86_64.nix.
Do you think that would make sense or should we just implement full source bootstrap as GUIX does?
It would be great to see some progress here!
Guix SD has achieved full source bootstrapping: https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/
For those reading this issue, check out the PRs linked in #227914 to see what packages have been added via the minimal bootstrap. Great progress so far, with expansion to other platforms planned!
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/aux-foundational-packages/46707/4
Has anyone looked into bootstrapping nixpkgs using zig? Sure, tarball would not be small enough to be committed into the repository but I feel like that would be a good solution all around, and it would not involve creating so many derivations to get a basic compiler
Well the initial post of the issue covers that. We could live with a large bootstrap tarball containing a relatively modern copy of gcc/clang/zig but that's then what we have to trust completely.
The objective is to have an auditable bootstrap from the smallest and most understandable binary blob.
The bootstrap process from hex0
is a bit arduous but that's also simply what it takes to rebuild to world from scratch.
That's not to say the current process can not be simplified further but there will always be a long process to get from a tiny mostly readable binary to a modern gcc/clang suite.
Motivation
Currently, NixOS relies on a 130 MB (uncompressed) bootstrap for x86_64-linux. Thus, there is quite a big trusted computing base. With years of effort accumulated in projects such as live-bootstrap, it appears feasible to replace the Linux stdenv with a far smaller base of around 1 KB, while retaining the latest versions of autotools, bash, gcc and so on to bootstrap the rest of Nixpkgs.
See also bootstrap seed reduction carried out in Guix[0].
References
[0] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25/