blob: 996f2f33ea35040fceca5ba46a359f8aea98d293 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
{ lib
, derivationWithMeta
, hostPlatform
, src
, version
, platforms
, stage0Arch
}:
let
hash = {
"x86" = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
"AMD64" = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY=";
}.${stage0Arch} or (throw "Unsupported system: ${hostPlatform.system}");
# Pinned from https://github.com/oriansj/stage0-posix/commit/3189b5f325b7ef8b88e3edec7c1cde4fce73c76c
# This 256 byte seed is the only pre-compiled binary in the bootstrap chain.
hex0-seed = import <nix/fetchurl.nix> {
name = "hex0-seed";
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${stage0Arch}/hex0-seed";
executable = true;
inherit hash;
};
in
derivationWithMeta {
inherit version;
pname = "hex0";
builder = hex0-seed;
args = [
"${src}/${stage0Arch}/hex0_${stage0Arch}.hex0"
(placeholder "out")
];
meta = with lib; {
description = "Minimal assembler for bootstrapping";
homepage = "https://github.com/oriansj/stage0-posix";
license = licenses.gpl3Plus;
maintainers = teams.minimal-bootstrap.members;
inherit platforms;
};
passthru = { inherit hex0-seed; };
# Ensure the untrusted hex0-seed binary produces a known-good hex0
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = hash;
}
|