Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimal-bootstrap: use recursive FOD to make nix unpack bootstrap sources #241001

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

emilytrau
Copy link
Member

Description of changes

This is an addendum to work done in #238357. Investigating it seems like the contents of the narball wasn't being unpacked, causing hex0 to not find sources for hex1 and hang. Switching to a recursive FOD seems like a solution?

Related #227914

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

1. Advice for manually assembling the bootstrap sources is restored.

2. Hash is no longer duplicated

3. More informative store path using `builtins.placeholder` is provided.
@ofborg ofborg bot requested a review from Ericson2314 July 11, 2023 22:02
@Ericson2314 Ericson2314 merged commit 78109c4 into NixOS:master Jul 11, 2023
4 checks passed
@Ericson2314
Copy link
Member

It builds again, but unfortunately I get a segfault building glibc.

@emilytrau emilytrau deleted the bootstrap-sources-recursive branch July 11, 2023 22:28
@zimbatm
Copy link
Member

zimbatm commented Jul 18, 2023

I'm not sure we fully understand the implications of this change. It's effectively changing the position of cache.nixos.org from being a cache to being a source for bootstrapping nixpkgs.

The advantage is pretty obvious, but I think there is a downside where bootstrapping becomes harder if cache.nixos.org were to disappear or lost those files.

@Ericson2314
Copy link
Member

I would say it's probably better to worry about such things when we're ready to switch over to this.

tarballs.nixos.org can be a substituter for fixed output things with a little bit of work, native git hashing support should hopefully make fetching these sources easier, etc.

@ghost
Copy link

ghost commented Jul 18, 2023

The advantage is pretty obvious, but I think there is a downside where bootstrapping becomes harder if cache.nixos.org were to disappear or lost those files.

If that happens, the build will fail with an error message which tells the user that they can resume the build without cache.nixos.org by running nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources, which will be byte-for-byte identical to the file expected from cache.nixos.org (it's a nar archive containing only source code).

It's impossible to give instructions like this for our current binary-bootstrap scheme. That's one of the major benefits of the minimal-bootstrap work.

Ultimately, this will allow tarballs.nixos.org to be reduced to nothing more than a cache. We might someday be able to retire it and have cache.nixos.org take over all of its duties!

@zimbatm
Copy link
Member

zimbatm commented Jul 18, 2023

Isn't nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources relying on the previous tarball to build itself?

@ghost
Copy link

ghost commented Jul 24, 2023

Isn't nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources relying on the previous tarball to build itself?

Keep reading....

# Or, if you prefer, you can create this file using only `git`,
# `nix`, and `xz`. For the commands needed in order to do this,
# see `make-bootstrap-sources.nix`. Once you have the manual

Of course, it would be better if we actually printed those lines, so the user could copy-paste them into the terminal:

  curl -L https://github.com/oriansj/stage0-posix/archive/3189b5f325b7ef8b88e3edec7c1cde4fce73c76c.tar.gz | tar -xvzf -
  mv stage0-posix-3189b5f325b7ef8b88e3edec7c1cde4fce73c76c stage0-posix-3189b5f325b7ef8b88e3edec7c1cde4fce73c76c-unstable-2023-05-02-source
  nix-store --add-fixed --recursive sha256 stage0-posix-3189b5f325b7ef8b88e3edec7c1cde4fce73c76c-unstable-2023-05-02-source

... but we would need a way to make sure these instructions stay "in sync" with the fetchFromGitHub expression used in make-minimal-bootstrap-sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants