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: point bootstrap sources to tarballs.nixos.org #232576

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ rec {
executable = true;
};

# Packaged resources required for the first bootstrapping stage.
# Contains source code and 256-byte hex0 binary seed.
# Packaged source files for the first bootstrapping stage.
#
# We don't have access to utilities such as fetchgit and fetchzip since this
# is this is part of the bootstrap process and would introduce a circular
Expand All @@ -25,10 +24,25 @@ rec {
# tarballs to be repackaged.
#
# To build see `make-bootstrap-sources.nix`

#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/<placeholder>
#
# Which used nixpkgs revision <placeholder>
# to instantiate:
#
# /nix/store/<placeholder>.drv
#
# and then built:
#
# /nix/store/<placeholder>
#
Comment on lines +27 to +41
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/<placeholder>
#
# Which used nixpkgs revision <placeholder>
# to instantiate:
#
# /nix/store/<placeholder>.drv
#
# and then built:
#
# /nix/store/<placeholder>
#

src = import <nix/fetchurl.nix> {
inherit name;
Comment on lines 42 to 43
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
src = import <nix/fetchurl.nix> {
inherit name;

url = "https://github.com/emilytrau/bootstrap-tools-nar-mirror/releases/download/2023-05-02/${name}.nar.xz";
hash = "sha256-ZRG0k49MxL1UTZhuMTvPoEprdSpJRNVy8QhLE6k+etg=";
url = "https://github.com/emilytrau/bootstrap-tools-nar-mirror/releases/download/2023-05-18/${name}.nar.xz";
emilytrau marked this conversation as resolved.
Show resolved Hide resolved
hash = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";
unpack = true;
};
}
Comment on lines +44 to 48
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url = "https://github.com/emilytrau/bootstrap-tools-nar-mirror/releases/download/2023-05-18/${name}.nar.xz";
hash = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";
unpack = true;
};
}

Please delete this, wait for Hydra to do the build, then re-add it using the tarballs.nixos.org url. That way there won't be any doubts raised about the commit at which Hydra does the build having access to this narball of questionable provenance.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ derivationWithMeta {
pname = "hex0";
builder = hex0-seed;
args = [
"${src}/bootstrap-seeds/POSIX/x86/hex0_x86.hex0"
"${src}/x86/hex0_x86.hex0"
(placeholder "out")
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ derivationWithMeta {
pname = "kaem-minimal";
builder = hex0;
args = [
"${src}/bootstrap-seeds/POSIX/x86/kaem-minimal.hex0"
"${src}/x86/kaem-minimal.hex0"
(placeholder "out")
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Packaged resources required for the first bootstrapping stage.
# Contains source code and 256-byte hex0 binary seed.
# Packaged source files for the first bootstrapping stage.
#
# We don't have access to utilities such as fetchgit and fetchzip since this
# is this is part of the bootstrap process and would introduce a circular
Expand All @@ -9,23 +8,30 @@
#
# To build:
#
# nix-build pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix
# nix-build . -A minimal-bootstrap-sources
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# nix-build . -A minimal-bootstrap-sources
# nix-build '<nixpkgs>' -A minimal-bootstrap-sources

# => ./result/stage0-posix-$version-$rev-source.nar.xz
#

{ pkgs ? import ../../../../.. {} }:
{ lib
, fetchFromGitHub
, runCommand
, nix
, xz
}:
let
inherit (pkgs) callPackage runCommand fetchFromGitHub nix xz;

inherit (import ./bootstrap-sources.nix) name rev;

src = fetchFromGitHub {
owner = "oriansj";
repo = "stage0-posix";
inherit rev;
sha256 = "sha256-ZRG0k49MxL1UTZhuMTvPoEprdSpJRNVy8QhLE6k+etg=";
sha256 = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";
fetchSubmodules = true;
postFetch = ''
# Seed binaries will be fetched separately
echo "Removing seed binaries"
rm -rf $out/bootstrap-seeds/*
emilytrau marked this conversation as resolved.
Show resolved Hide resolved

# Remove vendored/duplicate M2libc's
echo "Removing duplicate M2libc"
rm -rf \
Expand All @@ -40,6 +46,14 @@ runCommand name {
nativeBuildInputs = [ nix xz ];

passthru = { inherit src; };

meta = with lib; {
description = "Packaged sources for the first bootstrapping stage";
homepage = "https://github.com/oriansj/stage0-posix";
license = licenses.gpl3Plus;
maintainers = teams.minimal-bootstrap.members;
platforms = platforms.all;
};
} ''
mkdir $out
nix-store --dump ${src} | xz -c > "$out/${name}.nar.xz"
Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27102,6 +27102,7 @@ with pkgs;
inherit (stdenv) buildPlatform hostPlatform;
inherit lib config;
});
minimal-bootstrap-sources = callPackage ../os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix { };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no Hydra builds of minimal-bootstrap-sources yet.

In order to get a Hydra build you need to:

  1. merge a PR that has the line above
  2. wait for Hydra to build it
  3. then submit a separate PR which references that Hydra build.

The second PR is the one that should use the template @lovesegfault referenced.

Also, the provenance of builds on tarballs.nixos.org is a big deal. You should delete the fetchurl of https://github.com/emilytrau/bootstrap-tools-nar-mirror/ so it isn't anywhere in the nixpkgs repo at the commit from which Hydra builds the narball. Otherwise it's going to raise circularity suspicions.


mingetty = callPackage ../os-specific/linux/mingetty { };

Expand Down