Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

stdenv-darwin: allow easier testing of bootstrap tools

This un-hardcodes the bootstrap tools passed into the Darwin stdenv and
thus allows us to quickly iterate on improving the design of the full
bootstrap process. We can easily change the contents of the bootstrap
tools and evaluate an entire bootstrap all the way up to real packages.

+43 -30
+21 -20
pkgs/stdenv/darwin/default.nix
··· 1 - { system ? builtins.currentSystem 2 - , allPackages ? import ../../top-level/all-packages.nix 3 - , platform ? null 4 - , config ? {} 1 + { system ? builtins.currentSystem 2 + , allPackages ? import ../../top-level/all-packages.nix 3 + , platform ? null 4 + , config ? {} 5 + 6 + # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools 7 + , bootstrapFiles ? let 8 + fetch = { file, sha256, executable ? true }: import <nix/fetchurl.nix> { 9 + url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/4f07c88d467216d9692fefc951deb5cd3c4cc722/${file}"; 10 + inherit sha256 system executable; 11 + }; in { 12 + sh = fetch { file = "sh"; sha256 = "1siix3wakzil31r2cydmh3v8a1nyq4605dwiabqc5lx73j4xzrzi"; }; 13 + bzip2 = fetch { file = "bzip2"; sha256 = "0zvqm977k11b5cl4ixxb5h0ds24g6z0f8m28z4pqxzpa353lqbla"; }; 14 + mkdir = fetch { file = "mkdir"; sha256 = "13frk8lsfgzlb65p9l26cvxf06aag43yjk7vg9msn7ix3v8cmrg1"; }; 15 + cpio = fetch { file = "cpio"; sha256 = "0ms5i9m1vdksj575sf1djwgm7zhnvfrrb44dxnfh9avr793rc2w4"; }; 16 + tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "1lz1b0grl4642h6n635xvi6imf0yyy1zyzdr9ing5aphzz0z5iic"; executable = false; }; 17 + } 5 18 }: 6 19 7 20 let 8 21 libSystemProfile = '' 9 22 (import "${./standard-sandbox.sb}") 10 23 ''; 11 - 12 - fetch = { file, sha256, executable ? true }: import <nix/fetchurl.nix> { 13 - url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/4f07c88d467216d9692fefc951deb5cd3c4cc722/${file}"; 14 - inherit sha256 system executable; 15 - }; 16 - 17 - bootstrapFiles = { 18 - sh = fetch { file = "sh"; sha256 = "1siix3wakzil31r2cydmh3v8a1nyq4605dwiabqc5lx73j4xzrzi"; }; 19 - bzip2 = fetch { file = "bzip2"; sha256 = "0zvqm977k11b5cl4ixxb5h0ds24g6z0f8m28z4pqxzpa353lqbla"; }; 20 - mkdir = fetch { file = "mkdir"; sha256 = "13frk8lsfgzlb65p9l26cvxf06aag43yjk7vg9msn7ix3v8cmrg1"; }; 21 - cpio = fetch { file = "cpio"; sha256 = "0ms5i9m1vdksj575sf1djwgm7zhnvfrrb44dxnfh9avr793rc2w4"; }; 22 - }; 23 - 24 - tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "1lz1b0grl4642h6n635xvi6imf0yyy1zyzdr9ing5aphzz0z5iic"; executable = false; }; 25 24 in rec { 26 25 allPackages = import ../../top-level/all-packages.nix; 27 26 ··· 42 41 ''; 43 42 44 43 bootstrapTools = derivation rec { 45 - inherit system tarball; 44 + inherit system; 46 45 47 46 name = "bootstrap-tools"; 48 47 builder = bootstrapFiles.sh; # Not a filename! Attribute 'sh' on bootstrapFiles 49 48 args = [ ./unpack-bootstrap-tools.sh ]; 50 49 51 - inherit (bootstrapFiles) mkdir bzip2 cpio; 50 + inherit (bootstrapFiles) mkdir bzip2 cpio tarball; 52 51 53 52 __sandboxProfile = binShClosure + libSystemProfile; 54 53 }; ··· 306 305 inherit cc; 307 306 }; 308 307 }; 308 + 309 + stdenvDarwin = stage5; 309 310 }
+21 -9
pkgs/stdenv/darwin/make-bootstrap-tools.nix
··· 1 - with import ../../top-level/all-packages.nix { system = "x86_64-darwin"; }; 1 + { system ? builtins.currentSystem }: 2 + 3 + with import ../../top-level/all-packages.nix { inherit system; }; 2 4 3 5 rec { 4 6 # We want coreutils without ACL support. ··· 169 171 ''; 170 172 }; 171 173 172 - unpack = stdenv.mkDerivation { 174 + bootstrapFiles = { 175 + sh = "${build}/on-server/sh"; 176 + bzip2 = "${build}/on-server/bzip2"; 177 + mkdir = "${build}/on-server/mkdir"; 178 + cpio = "${build}/on-server/cpio"; 179 + tarball = "${build}/on-server/bootstrap-tools.cpio.bz2"; 180 + }; 181 + 182 + unpack = stdenv.mkDerivation (bootstrapFiles // { 173 183 name = "unpack"; 174 184 175 185 # This is by necessity a near-duplicate of unpack-bootstrap-tools.sh. If we refer to it directly, ··· 216 226 EOF 217 227 ''; 218 228 219 - tarball = "${build}/on-server/bootstrap-tools.cpio.bz2"; 220 - 221 - mkdir = "${build}/on-server/mkdir"; 222 - bzip2 = "${build}/on-server/bzip2"; 223 - cpio = "${build}/on-server/cpio"; 224 - 225 229 allowedReferences = [ "out" ]; 226 - }; 230 + }); 227 231 228 232 test = stdenv.mkDerivation { 229 233 name = "test"; ··· 282 286 283 287 $out/bin/hello 284 288 ''; 289 + }; 290 + 291 + # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it 292 + test-pkgs = let 293 + stdenv = import ./. { inherit system bootstrapFiles; }; 294 + in import ../../top-level/all-packages.nix { 295 + inherit system; 296 + bootStdenv = stdenv.stdenvDarwin; 285 297 }; 286 298 }
+1 -1
pkgs/stdenv/default.nix
··· 36 36 # Linux standard environment. 37 37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux; 38 38 39 - stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5; 39 + stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin; 40 40 41 41 # Select the appropriate stdenv for the platform `system'. 42 42 stdenv =