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 ? {} 5 }: 6 7 let 8 libSystemProfile = '' 9 (import "${./standard-sandbox.sb}") 10 ''; 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 in rec { 26 allPackages = import ../../top-level/all-packages.nix; 27 ··· 42 ''; 43 44 bootstrapTools = derivation rec { 45 - inherit system tarball; 46 47 name = "bootstrap-tools"; 48 builder = bootstrapFiles.sh; # Not a filename! Attribute 'sh' on bootstrapFiles 49 args = [ ./unpack-bootstrap-tools.sh ]; 50 51 - inherit (bootstrapFiles) mkdir bzip2 cpio; 52 53 __sandboxProfile = binShClosure + libSystemProfile; 54 }; ··· 306 inherit cc; 307 }; 308 }; 309 }
··· 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 + } 18 }: 19 20 let 21 libSystemProfile = '' 22 (import "${./standard-sandbox.sb}") 23 ''; 24 in rec { 25 allPackages = import ../../top-level/all-packages.nix; 26 ··· 41 ''; 42 43 bootstrapTools = derivation rec { 44 + inherit system; 45 46 name = "bootstrap-tools"; 47 builder = bootstrapFiles.sh; # Not a filename! Attribute 'sh' on bootstrapFiles 48 args = [ ./unpack-bootstrap-tools.sh ]; 49 50 + inherit (bootstrapFiles) mkdir bzip2 cpio tarball; 51 52 __sandboxProfile = binShClosure + libSystemProfile; 53 }; ··· 305 inherit cc; 306 }; 307 }; 308 + 309 + stdenvDarwin = stage5; 310 }
+21 -9
pkgs/stdenv/darwin/make-bootstrap-tools.nix
··· 1 - with import ../../top-level/all-packages.nix { system = "x86_64-darwin"; }; 2 3 rec { 4 # We want coreutils without ACL support. ··· 169 ''; 170 }; 171 172 - unpack = stdenv.mkDerivation { 173 name = "unpack"; 174 175 # This is by necessity a near-duplicate of unpack-bootstrap-tools.sh. If we refer to it directly, ··· 216 EOF 217 ''; 218 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 allowedReferences = [ "out" ]; 226 - }; 227 228 test = stdenv.mkDerivation { 229 name = "test"; ··· 282 283 $out/bin/hello 284 ''; 285 }; 286 }
··· 1 + { system ? builtins.currentSystem }: 2 + 3 + with import ../../top-level/all-packages.nix { inherit system; }; 4 5 rec { 6 # We want coreutils without ACL support. ··· 171 ''; 172 }; 173 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 // { 183 name = "unpack"; 184 185 # This is by necessity a near-duplicate of unpack-bootstrap-tools.sh. If we refer to it directly, ··· 226 EOF 227 ''; 228 229 allowedReferences = [ "out" ]; 230 + }); 231 232 test = stdenv.mkDerivation { 233 name = "test"; ··· 286 287 $out/bin/hello 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; 297 }; 298 }
+1 -1
pkgs/stdenv/default.nix
··· 36 # Linux standard environment. 37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux; 38 39 - stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5; 40 41 # Select the appropriate stdenv for the platform `system'. 42 stdenv =
··· 36 # Linux standard environment. 37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux; 38 39 + stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin; 40 41 # Select the appropriate stdenv for the platform `system'. 42 stdenv =