Merge pull request #241001 from emilytrau/bootstrap-sources-recursive
minimal-bootstrap: use recursive FOD to make nix unpack bootstrap sources
This commit is contained in:
commit
78109c4d49
2 changed files with 35 additions and 46 deletions
|
@ -7,6 +7,7 @@ rec {
|
||||||
version = "unstable-2023-05-02";
|
version = "unstable-2023-05-02";
|
||||||
rev = "3189b5f325b7ef8b88e3edec7c1cde4fce73c76c";
|
rev = "3189b5f325b7ef8b88e3edec7c1cde4fce73c76c";
|
||||||
outputHashAlgo = "sha256";
|
outputHashAlgo = "sha256";
|
||||||
|
outputHash = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";
|
||||||
|
|
||||||
# This 256 byte seed is the only pre-compiled binary in the bootstrap chain.
|
# This 256 byte seed is the only pre-compiled binary in the bootstrap chain.
|
||||||
hex0-seed = import <nix/fetchurl.nix> {
|
hex0-seed = import <nix/fetchurl.nix> {
|
||||||
|
@ -29,7 +30,7 @@ rec {
|
||||||
|
|
||||||
Run the following command:
|
Run the following command:
|
||||||
```
|
```
|
||||||
nix hash file $(nix build --print-out-paths -f '<nixpkgs>' make-minimal-bootstrap-sources)
|
nix hash path $(nix build --print-out-paths -f '<nixpkgs>' make-minimal-bootstrap-sources)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Why do we need this `.nar` archive?
|
# Why do we need this `.nar` archive?
|
||||||
|
@ -71,11 +72,10 @@ rec {
|
||||||
requirements above apply to `minimal-bootstrap-sources`.
|
requirements above apply to `minimal-bootstrap-sources`.
|
||||||
*/
|
*/
|
||||||
minimal-bootstrap-sources = derivation {
|
minimal-bootstrap-sources = derivation {
|
||||||
name = "${name}.nar.xz";
|
inherit name;
|
||||||
system = builtins.currentSystem;
|
system = builtins.currentSystem;
|
||||||
outputHashMode = "flat";
|
outputHashMode = "recursive";
|
||||||
inherit outputHashAlgo;
|
inherit outputHashAlgo outputHash;
|
||||||
outputHash = "sha256-ig988BiRTz92hhZZgKQW1tVPoV4aQ2D69Cq3wHvVgHg=";
|
|
||||||
|
|
||||||
# This builder always fails, but fortunately Nix will print the
|
# This builder always fails, but fortunately Nix will print the
|
||||||
# "builder", which is really the error message that we want the
|
# "builder", which is really the error message that we want the
|
||||||
|
@ -85,22 +85,21 @@ rec {
|
||||||
#
|
#
|
||||||
# Neither your store nor your substituters seems to have:
|
# Neither your store nor your substituters seems to have:
|
||||||
#
|
#
|
||||||
# ${name}.nar.xz
|
# ${builtins.placeholder "out"}
|
||||||
#
|
#
|
||||||
# Please obtain or create this file, give it exactly the name
|
# You can create this path from an already-bootstrapped nixpkgs
|
||||||
# shown above, and then run the following command:
|
|
||||||
#
|
|
||||||
# nix-store --add-fixed ${outputHashAlgo} ${name}.nar.xz
|
|
||||||
#
|
|
||||||
# You can create this file from an already-bootstrapped nixpkgs
|
|
||||||
# using the following command:
|
# using the following command:
|
||||||
#
|
#
|
||||||
# nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources
|
# nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources
|
||||||
#
|
#
|
||||||
# Or, if you prefer, you can create this file using only `git`,
|
# Or, if you prefer, you can create this file using only `git`,
|
||||||
# `nix`, and `xz`. For the commands needed in order to do this,
|
# `nix`, and `xz`. For the commands needed in order to do this,
|
||||||
# see `make-bootstrap-sources.nix`.
|
# see `make-bootstrap-sources.nix`. Once you have the manual
|
||||||
|
# result, do:
|
||||||
#
|
#
|
||||||
|
# nix-store --add-fixed --recursive ${outputHashAlgo} ./${name}
|
||||||
|
#
|
||||||
|
# to add it to your store.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,44 +8,36 @@
|
||||||
#
|
#
|
||||||
# To build:
|
# To build:
|
||||||
#
|
#
|
||||||
# nix-build '<nixpkgs>' -o sources.nar.xz -A make-minimal-bootstrap-sources
|
# nix-build '<nixpkgs>' -A make-minimal-bootstrap-sources
|
||||||
#
|
#
|
||||||
|
|
||||||
{ lib
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, runCommand
|
|
||||||
, nix
|
|
||||||
, xz
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (import ./bootstrap-sources.nix { }) name rev;
|
expected = import ./bootstrap-sources.nix { };
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "oriansj";
|
|
||||||
repo = "stage0-posix";
|
|
||||||
inherit rev;
|
|
||||||
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/*
|
|
||||||
|
|
||||||
# Remove vendored/duplicate M2libc's
|
|
||||||
echo "Removing duplicate M2libc"
|
|
||||||
rm -rf \
|
|
||||||
$out/M2-Mesoplanet/M2libc \
|
|
||||||
$out/M2-Planet/M2libc \
|
|
||||||
$out/mescc-tools/M2libc \
|
|
||||||
$out/mescc-tools-extra/M2libc
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
runCommand "${name}.nar.xz" {
|
|
||||||
nativeBuildInputs = [ nix xz ];
|
|
||||||
|
|
||||||
passthru = { inherit src; };
|
fetchFromGitHub {
|
||||||
|
inherit (expected) name rev;
|
||||||
|
owner = "oriansj";
|
||||||
|
repo = "stage0-posix";
|
||||||
|
sha256 = expected.outputHash;
|
||||||
|
fetchSubmodules = true;
|
||||||
|
postFetch = ''
|
||||||
|
# Seed binaries will be fetched separately
|
||||||
|
echo "Removing seed binaries"
|
||||||
|
rm -rf $out/bootstrap-seeds/*
|
||||||
|
|
||||||
|
# Remove vendored/duplicate M2libc's
|
||||||
|
echo "Removing duplicate M2libc"
|
||||||
|
rm -rf \
|
||||||
|
$out/M2-Mesoplanet/M2libc \
|
||||||
|
$out/M2-Planet/M2libc \
|
||||||
|
$out/mescc-tools/M2libc \
|
||||||
|
$out/mescc-tools-extra/M2libc
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Packaged sources for the first bootstrapping stage";
|
description = "Packaged sources for the first bootstrapping stage";
|
||||||
|
@ -54,6 +46,4 @@ runCommand "${name}.nar.xz" {
|
||||||
maintainers = teams.minimal-bootstrap.members;
|
maintainers = teams.minimal-bootstrap.members;
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
};
|
};
|
||||||
} ''
|
}
|
||||||
nix-store --dump ${src} | xz -c > $out
|
|
||||||
''
|
|
||||||
|
|
Loading…
Reference in a new issue