mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 07:00:43 +00:00
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.
This commit is contained in:
parent
88c41e1f95
commit
0313b2e09c
|
@ -1,27 +1,26 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, allPackages ? import ../../top-level/all-packages.nix
|
||||
, platform ? null
|
||||
, config ? {}
|
||||
{ system ? builtins.currentSystem
|
||||
, allPackages ? import ../../top-level/all-packages.nix
|
||||
, platform ? null
|
||||
, config ? {}
|
||||
|
||||
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
||||
, bootstrapFiles ? let
|
||||
fetch = { file, sha256, executable ? true }: import <nix/fetchurl.nix> {
|
||||
url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/4f07c88d467216d9692fefc951deb5cd3c4cc722/${file}";
|
||||
inherit sha256 system executable;
|
||||
}; in {
|
||||
sh = fetch { file = "sh"; sha256 = "1siix3wakzil31r2cydmh3v8a1nyq4605dwiabqc5lx73j4xzrzi"; };
|
||||
bzip2 = fetch { file = "bzip2"; sha256 = "0zvqm977k11b5cl4ixxb5h0ds24g6z0f8m28z4pqxzpa353lqbla"; };
|
||||
mkdir = fetch { file = "mkdir"; sha256 = "13frk8lsfgzlb65p9l26cvxf06aag43yjk7vg9msn7ix3v8cmrg1"; };
|
||||
cpio = fetch { file = "cpio"; sha256 = "0ms5i9m1vdksj575sf1djwgm7zhnvfrrb44dxnfh9avr793rc2w4"; };
|
||||
tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "1lz1b0grl4642h6n635xvi6imf0yyy1zyzdr9ing5aphzz0z5iic"; executable = false; };
|
||||
}
|
||||
}:
|
||||
|
||||
let
|
||||
libSystemProfile = ''
|
||||
(import "${./standard-sandbox.sb}")
|
||||
'';
|
||||
|
||||
fetch = { file, sha256, executable ? true }: import <nix/fetchurl.nix> {
|
||||
url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/4f07c88d467216d9692fefc951deb5cd3c4cc722/${file}";
|
||||
inherit sha256 system executable;
|
||||
};
|
||||
|
||||
bootstrapFiles = {
|
||||
sh = fetch { file = "sh"; sha256 = "1siix3wakzil31r2cydmh3v8a1nyq4605dwiabqc5lx73j4xzrzi"; };
|
||||
bzip2 = fetch { file = "bzip2"; sha256 = "0zvqm977k11b5cl4ixxb5h0ds24g6z0f8m28z4pqxzpa353lqbla"; };
|
||||
mkdir = fetch { file = "mkdir"; sha256 = "13frk8lsfgzlb65p9l26cvxf06aag43yjk7vg9msn7ix3v8cmrg1"; };
|
||||
cpio = fetch { file = "cpio"; sha256 = "0ms5i9m1vdksj575sf1djwgm7zhnvfrrb44dxnfh9avr793rc2w4"; };
|
||||
};
|
||||
|
||||
tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "1lz1b0grl4642h6n635xvi6imf0yyy1zyzdr9ing5aphzz0z5iic"; executable = false; };
|
||||
in rec {
|
||||
allPackages = import ../../top-level/all-packages.nix;
|
||||
|
||||
|
@ -42,13 +41,13 @@ in rec {
|
|||
'';
|
||||
|
||||
bootstrapTools = derivation rec {
|
||||
inherit system tarball;
|
||||
inherit system;
|
||||
|
||||
name = "bootstrap-tools";
|
||||
builder = bootstrapFiles.sh; # Not a filename! Attribute 'sh' on bootstrapFiles
|
||||
args = [ ./unpack-bootstrap-tools.sh ];
|
||||
|
||||
inherit (bootstrapFiles) mkdir bzip2 cpio;
|
||||
inherit (bootstrapFiles) mkdir bzip2 cpio tarball;
|
||||
|
||||
__sandboxProfile = binShClosure + libSystemProfile;
|
||||
};
|
||||
|
@ -306,4 +305,6 @@ in rec {
|
|||
inherit cc;
|
||||
};
|
||||
};
|
||||
|
||||
stdenvDarwin = stage5;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
with import ../../top-level/all-packages.nix { system = "x86_64-darwin"; };
|
||||
{ system ? builtins.currentSystem }:
|
||||
|
||||
with import ../../top-level/all-packages.nix { inherit system; };
|
||||
|
||||
rec {
|
||||
# We want coreutils without ACL support.
|
||||
|
@ -169,7 +171,15 @@ rec {
|
|||
'';
|
||||
};
|
||||
|
||||
unpack = stdenv.mkDerivation {
|
||||
bootstrapFiles = {
|
||||
sh = "${build}/on-server/sh";
|
||||
bzip2 = "${build}/on-server/bzip2";
|
||||
mkdir = "${build}/on-server/mkdir";
|
||||
cpio = "${build}/on-server/cpio";
|
||||
tarball = "${build}/on-server/bootstrap-tools.cpio.bz2";
|
||||
};
|
||||
|
||||
unpack = stdenv.mkDerivation (bootstrapFiles // {
|
||||
name = "unpack";
|
||||
|
||||
# This is by necessity a near-duplicate of unpack-bootstrap-tools.sh. If we refer to it directly,
|
||||
|
@ -216,14 +226,8 @@ rec {
|
|||
EOF
|
||||
'';
|
||||
|
||||
tarball = "${build}/on-server/bootstrap-tools.cpio.bz2";
|
||||
|
||||
mkdir = "${build}/on-server/mkdir";
|
||||
bzip2 = "${build}/on-server/bzip2";
|
||||
cpio = "${build}/on-server/cpio";
|
||||
|
||||
allowedReferences = [ "out" ];
|
||||
};
|
||||
});
|
||||
|
||||
test = stdenv.mkDerivation {
|
||||
name = "test";
|
||||
|
@ -283,4 +287,12 @@ rec {
|
|||
$out/bin/hello
|
||||
'';
|
||||
};
|
||||
|
||||
# The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
|
||||
test-pkgs = let
|
||||
stdenv = import ./. { inherit system bootstrapFiles; };
|
||||
in import ../../top-level/all-packages.nix {
|
||||
inherit system;
|
||||
bootStdenv = stdenv.stdenvDarwin;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ rec {
|
|||
# Linux standard environment.
|
||||
stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
|
||||
|
||||
stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5;
|
||||
stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin;
|
||||
|
||||
# Select the appropriate stdenv for the platform `system'.
|
||||
stdenv =
|
||||
|
|
Loading…
Reference in a new issue