about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix28
1 files changed, 24 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix b/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
index b85b2f2cac14..996f2f33ea35 100644
--- a/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
+++ b/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
@@ -1,15 +1,33 @@
 { lib
 , derivationWithMeta
-, hex0-seed
+, 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}/x86/hex0_x86.hex0"
+    "${src}/${stage0Arch}/hex0_${stage0Arch}.hex0"
     (placeholder "out")
   ];
 
@@ -18,11 +36,13 @@ derivationWithMeta {
     homepage = "https://github.com/oriansj/stage0-posix";
     license = licenses.gpl3Plus;
     maintainers = teams.minimal-bootstrap.members;
-    platforms = [ "i686-linux" ];
+    inherit platforms;
   };
 
+  passthru = { inherit hex0-seed; };
+
   # Ensure the untrusted hex0-seed binary produces a known-good hex0
   outputHashMode = "recursive";
   outputHashAlgo = "sha256";
-  outputHash = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
+  outputHash = hash;
 }