summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2017-08-18 09:04:41 -0400
committerGitHub <noreply@github.com>2017-08-18 09:04:41 -0400
commitb190c06e32b8687eb7a48b53aba22281a0a38349 (patch)
treeed13dfab538ae957c60fbba5392c6283ca0be38b
parentfb70d08232914ccdbcf0c25744f978d9b9173b31 (diff)
parent61d241f405ad960e111848a60477fd5792913366 (diff)
downloadnixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar.gz
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar.bz2
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar.lz
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar.xz
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.tar.zst
nixpkgs-b190c06e32b8687eb7a48b53aba22281a0a38349.zip
Merge pull request #28322 from Ericson2314/darwin-boot
darwin stdenv: Float `persistentN` bindings into per-stage `let`s
-rw-r--r--pkgs/stdenv/darwin/default.nix133
1 files changed, 67 insertions, 66 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index 74dcf2f009b..4994de8bc03 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -165,32 +165,32 @@ in rec {
     extraBuildInputs = [];
   };
 
-  persistent0 = _: _: _: {};
-
-  stage1 = prevStage: with prevStage; stageFun 1 prevStage {
+  stage1 = prevStage: let
+    persistent = _: _: {};
+  in with prevStage; stageFun 1 prevStage {
     extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
     extraBuildInputs = [ pkgs.libcxx ];
 
     allowedRequisites =
       [ bootstrapTools ] ++ (with pkgs; [ libcxx libcxxabi ]) ++ [ pkgs.darwin.Libsystem ];
 
-    overrides = persistent0 prevStage;
+    overrides = persistent;
   };
 
-  persistent1 = prevStage: self: super: with prevStage; {
-    inherit
-      zlib patchutils m4 scons flex perl bison unifdef unzip openssl python
-      libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff
-      openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz
-      findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils;
+  stage2 = prevStage: let
+    persistent = self: super: with prevStage; {
+      inherit
+        zlib patchutils m4 scons flex perl bison unifdef unzip openssl python
+        libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff
+        openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz
+        findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils;
 
-    darwin = super.darwin // {
-      inherit (darwin)
-        dyld Libsystem xnu configd ICU libdispatch libclosure launchd;
+      darwin = super.darwin // {
+        inherit (darwin)
+          dyld Libsystem xnu configd ICU libdispatch libclosure launchd;
+      };
     };
-  };
-
-  stage2 = prevStage: with prevStage; stageFun 2 prevStage {
+  in with prevStage; stageFun 2 prevStage {
     extraPreHook = ''
       export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
     '';
@@ -202,24 +202,24 @@ in rec {
       (with pkgs; [ xz.bin xz.out libcxx libcxxabi ]) ++
       (with pkgs.darwin; [ dyld Libsystem CF ICU locale ]);
 
-    overrides = persistent1 prevStage;
+    overrides = persistent;
   };
 
-  persistent2 = prevStage: self: super: with prevStage; {
-    inherit
-      patchutils m4 scons flex perl bison unifdef unzip openssl python
-      gettext sharutils libarchive pkg-config groff bash subversion
-      openssh sqlite sed serf openldap db cyrus-sasl expat apr-util
-      findfreetype libssh curl cmake autoconf automake libtool cpio
-      libcxx libcxxabi;
-
-    darwin = super.darwin // {
-      inherit (darwin)
-        dyld Libsystem xnu configd libdispatch libclosure launchd libiconv locale;
-    };
-  };
+  stage3 = prevStage: let
+    persistent = self: super: with prevStage; {
+      inherit
+        patchutils m4 scons flex perl bison unifdef unzip openssl python
+        gettext sharutils libarchive pkg-config groff bash subversion
+        openssh sqlite sed serf openldap db cyrus-sasl expat apr-util
+        findfreetype libssh curl cmake autoconf automake libtool cpio
+        libcxx libcxxabi;
 
-  stage3 = prevStage: with prevStage; stageFun 3 prevStage {
+      darwin = super.darwin // {
+        inherit (darwin)
+          dyld Libsystem xnu configd libdispatch libclosure launchd libiconv locale;
+      };
+    };
+  in with prevStage; stageFun 3 prevStage {
     shell = "${pkgs.bash}/bin/bash";
 
     # We have a valid shell here (this one has no bootstrap-tools runtime deps) so stageFun
@@ -238,54 +238,55 @@ in rec {
       (with pkgs; [ xz.bin xz.out bash libcxx libcxxabi ]) ++
       (with pkgs.darwin; [ dyld ICU Libsystem locale ]);
 
-    overrides = persistent2 prevStage;
+    overrides = persistent;
   };
 
-  persistent3 = prevStage: self: super: with prevStage; {
-    inherit
-      gnumake gzip gnused bzip2 gawk ed xz patch bash
-      libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
-      coreutils findutils diffutils patchutils;
+  stage4 = prevStage: let
+    persistent = self: super: with prevStage; {
+      inherit
+        gnumake gzip gnused bzip2 gawk ed xz patch bash
+        libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
+        coreutils findutils diffutils patchutils;
 
-     llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
-     in super.llvmPackages // {
-       llvm = llvmOverride;
-       clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
-     };
+       llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
+       in super.llvmPackages // {
+         llvm = llvmOverride;
+         clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
+       };
 
-    darwin = super.darwin // {
-      inherit (darwin) dyld Libsystem libiconv locale;
+      darwin = super.darwin // {
+        inherit (darwin) dyld Libsystem libiconv locale;
+      };
     };
-  };
-
-  stage4 = prevStage: with prevStage; stageFun 4 prevStage {
+  in with prevStage; stageFun 4 prevStage {
     shell = "${pkgs.bash}/bin/bash";
     extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ];
     extraPreHook = ''
       export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
     '';
-    overrides = persistent3 prevStage;
+    overrides = persistent;
   };
 
-  persistent4 = prevStage: self: super: with prevStage; {
-    inherit
-      gnumake gzip gnused bzip2 gawk ed xz patch bash
-      libcxxabi libcxx ncurses libffi zlib llvm gmp pcre gnugrep
-      coreutils findutils diffutils patchutils;
+  stdenvDarwin = prevStage: let
+    pkgs = prevStage;
+    persistent = self: super: with prevStage; {
+      inherit
+        gnumake gzip gnused bzip2 gawk ed xz patch bash
+        libcxxabi libcxx ncurses libffi zlib llvm gmp pcre gnugrep
+        coreutils findutils diffutils patchutils;
 
-    llvmPackages = super.llvmPackages // {
-      inherit (llvmPackages) llvm clang-unwrapped;
-    };
+      llvmPackages = super.llvmPackages // {
+        inherit (llvmPackages) llvm clang-unwrapped;
+      };
 
-    darwin = super.darwin // {
-      inherit (darwin) dyld ICU Libsystem cctools libiconv;
+      darwin = super.darwin // {
+        inherit (darwin) dyld ICU Libsystem cctools libiconv;
+      };
+    } // lib.optionalAttrs (super.targetPlatform == localSystem) {
+      # Need to get rid of these when cross-compiling.
+      inherit binutils binutils-raw;
     };
-  } // lib.optionalAttrs (super.targetPlatform == localSystem) {
-    # Need to get rid of these when cross-compiling.
-    inherit binutils binutils-raw;
-  };
-
-  stdenvDarwin = prevStage: let pkgs = prevStage; in import ../generic rec {
+  in import ../generic rec {
     inherit config;
     inherit (pkgs.stdenv) fetchurlBoot;
 
@@ -344,9 +345,9 @@ in rec {
     ]);
 
     overrides = self: super:
-      let persistent = persistent4 prevStage self super; in persistent // {
+      let persistent' = persistent self super; in persistent' // {
         clang = cc;
-        llvmPackages = persistent.llvmPackages // { clang = cc; };
+        llvmPackages = persistent'.llvmPackages // { clang = cc; };
         inherit cc;
       };
   };