Skip to content

Instantly share code, notes, and snippets.

@LnL7
Last active November 13, 2020 21:22
Show Gist options
  • Save LnL7/a17a042dd21258b957279637bb6be627 to your computer and use it in GitHub Desktop.
Save LnL7/a17a042dd21258b957279637bb6be627 to your computer and use it in GitHub Desktop.
diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
index 761ff3ea925..a8f667dcbe7 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
@@ -20,4 +20,8 @@ appleDerivation {
mv $out/usr/local/include $out/include
rm -rf $out/usr
'';
+
+ failureHook = ''
+ cat build/config.log
+ '';
}
diff --git a/pkgs/os-specific/darwin/darwin-stubs/default.nix b/pkgs/os-specific/darwin/darwin-stubs/default.nix
index f7f083e32f4..8b4031aea1e 100644
--- a/pkgs/os-specific/darwin/darwin-stubs/default.nix
+++ b/pkgs/os-specific/darwin/darwin-stubs/default.nix
@@ -1,14 +1,12 @@
-{ stdenv, fetchFromGitHub }:
+{ stdenv, fetchurl }:
stdenv.mkDerivation {
pname = "darwin-stubs";
version = "10.12";
- src = fetchFromGitHub {
- owner = "NixOS";
- repo = "darwin-stubs";
- rev = "80b3d4a57d3454c975eefd984c804dbd76f04ef2";
- sha256 = "0sslg4rmskms8ixixv1gvnrvvvmn723vbfjj6mcn24fj2ncg38y7";
+ src = fetchurl {
+ url = "https://github.com/NixOS/darwin-stubs/archive/80b3d4a57d3454c975eefd984c804dbd76f04ef2.tar.gz";
+ sha256 = "sha256-+N5xlrOSKbYy7sUwVS0ZBkeB96qwdBQEPVQ2rQV+me4=";
};
dontBuild = true;
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index f07b1ee73b8..adea93a2c39 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -167,19 +167,38 @@ in rec {
stage0 = stageFun 0 null {
overrides = self: super: with stage0; {
- coreutils = { name = "bootstrap-stage0-coreutils"; outPath = bootstrapTools; };
- gnugrep = { name = "bootstrap-stage0-gnugrep"; outPath = bootstrapTools; };
+ coreutils = stdenv.mkDerivation {
+ name = "bootstrap-stage0-coreutils";
+ buildCommand = ''
+ mkdir -p $out
+ ln -s ${bootstrapTools}/bin $out/bin
+ '';
+ };
+
+ gnugrep = stdenv.mkDerivation {
+ name = "bootstrap-stage0-gnugrep";
+ buildCommand = ''
+ mkdir -p $out
+ ln -s ${bootstrapTools}/bin $out/bin
+ '';
+ };
darwin = super.darwin // {
Libsystem = stdenv.mkDerivation {
name = "bootstrap-stage0-Libsystem";
buildCommand = ''
mkdir -p $out
- ln -s ${bootstrapTools}/lib $out/lib
+ cp -r ${self.darwin.darwin-stubs}/usr/lib $out/lib
+ chmod -R +w $out/lib
+ substituteInPlace $out/lib/libSystem.B.tbd --replace /usr/lib/system $out/lib/system
+ ln -s libSystem.B.tbd $out/lib/libSystem.tbd
ln -s ${bootstrapTools}/include-Libsystem $out/include
'';
};
- dyld = bootstrapTools;
+
+ darwin-stubs = super.darwin.darwin-stubs.override { inherit (self) stdenv fetchurl; };
+
+ dyld = { name = "bootstrap-stage0-dyld"; outPath = bootstrapTools; };
binutils = lib.makeOverridable (import ../../build-support/bintools-wrapper) {
shell = "${bootstrapTools}/bin/bash";
@@ -194,10 +213,15 @@ in rec {
};
llvmPackages_7 = {
- clang-unwrapped = {
+ clang-unwrapped = stdenv.mkDerivation {
name = "bootstrap-stage0-clang";
- outPath = bootstrapTools;
version = bootstrapClangVersion;
+ buildCommand = ''
+ mkdir -p $out/lib
+ ln -s ${bootstrapTools}/bin $out/bin
+ ln -s ${bootstrapTools}/lib/clang $out/lib/clang
+ ln -s ${bootstrapTools}/include $out/include
+ '';
};
libcxx = stdenv.mkDerivation {
@@ -268,8 +292,8 @@ in rec {
allowedRequisites =
[ bootstrapTools ] ++
- (with pkgs; [ libcxx libcxxabi llvmPackages_7.compiler-rt ]) ++
- (with pkgs.darwin; [ Libsystem ]);
+ (with pkgs; [ coreutils gnugrep libcxx libcxxabi llvmPackages_7.clang-unwrapped llvmPackages_7.compiler-rt ]) ++
+ (with pkgs.darwin; [ darwin-stubs Libsystem ]);
overrides = persistent;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment