summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-08-17 10:29:12 -0500
committerGitHub <noreply@github.com>2018-08-17 10:29:12 -0500
commit4ff7702082bad838e70140091afe7e77a9f00eca (patch)
treed99a2a14e45e448442bfe669cb21fe0edf0ae7c8
parentcbabebcc2e3b884296fedf8591e04f59240b3939 (diff)
parentee92ab07bae7018486af54ef3b559bf048e331a7 (diff)
downloadnixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar.gz
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar.bz2
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar.lz
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar.xz
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.tar.zst
nixlib-4ff7702082bad838e70140091afe7e77a9f00eca.zip
Merge pull request #45183 from matthewbauer/macdevelop
Assorted darwin/macOS fixes
-rw-r--r--pkgs/applications/audio/chuck/default.nix32
-rw-r--r--pkgs/applications/misc/doomseeker/default.nix6
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/cmake.patch19
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix7
-rw-r--r--pkgs/development/libraries/libglvnd/default.nix11
-rw-r--r--pkgs/development/libraries/qca2/default.nix11
-rw-r--r--pkgs/development/libraries/v8/default.nix12
-rw-r--r--pkgs/development/libraries/v8/no-xcode.patch64
-rw-r--r--pkgs/development/python-modules/Cython/default.nix2
-rw-r--r--pkgs/development/python-modules/ldap/default.nix4
-rw-r--r--pkgs/development/python-modules/tqdm/default.nix3
-rw-r--r--pkgs/development/web/nodejs/no-xcode-v7.patch79
-rw-r--r--pkgs/development/web/nodejs/no-xcode.patch57
-rw-r--r--pkgs/development/web/nodejs/no-xcodebuild.patch13
-rw-r--r--pkgs/development/web/nodejs/nodejs.nix14
-rw-r--r--pkgs/development/web/nodejs/v10.nix1
-rw-r--r--pkgs/development/web/nodejs/v6.nix1
-rw-r--r--pkgs/development/web/nodejs/v8.nix1
-rw-r--r--pkgs/top-level/all-packages.nix1
19 files changed, 59 insertions, 279 deletions
diff --git a/pkgs/applications/audio/chuck/default.nix b/pkgs/applications/audio/chuck/default.nix
index e94172b0f879..c10556260c71 100644
--- a/pkgs/applications/audio/chuck/default.nix
+++ b/pkgs/applications/audio/chuck/default.nix
@@ -1,5 +1,6 @@
-{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which
+{ stdenv, lib, fetchurl, alsaLib, bison, flex, libsndfile, which
 , AppKit, Carbon, CoreAudio, CoreMIDI, CoreServices, Kernel
+, xcbuild
 }:
 
 stdenv.mkDerivation rec {
@@ -11,31 +12,28 @@ stdenv.mkDerivation rec {
     sha256 = "02z7sglax3j09grj5s1skmw8z6wz7b21hjrm95nrrdpwbxabh079";
   };
 
-  buildInputs = [ bison flex libsndfile which ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib
-    ++ stdenv.lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];
+  nativeBuildInputs = [ flex bison which ];
+
+  buildInputs = [ libsndfile ]
+    ++ lib.optional (!stdenv.isDarwin) alsaLib
+    ++ lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];
 
   patches = [ ./clang.patch ./darwin-limits.patch ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-Wno-missing-sysroot";
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework MultitouchSupport";
+  NIX_CFLAGS_COMPILE = lib.optional stdenv.isDarwin "-Wno-missing-sysroot";
+  NIX_LDFLAGS = lib.optional stdenv.isDarwin "-framework MultitouchSupport";
 
   postPatch = ''
     substituteInPlace src/makefile --replace "/usr/bin" "$out/bin"
-    substituteInPlace src/makefile.osx --replace "xcodebuild" "/usr/bin/xcodebuild"
-    substituteInPlace src/makefile.osx --replace "weak_framework" "framework"
-    substituteInPlace src/makefile.osx --replace "MACOSX_DEPLOYMENT_TARGET=10.5" "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET"
-  '';
-
-  buildPhase = ''
-    make -C src ${if stdenv.isDarwin then "osx" else "linux-alsa"}
+    substituteInPlace src/makefile.osx \
+      --replace "weak_framework" "framework" \
+      --replace "MACOSX_DEPLOYMENT_TARGET=10.5" "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET"
   '';
 
-  installPhase = ''
-    install -Dm755 ./src/chuck $out/bin/chuck
-  '';
+  makeFlags = [ "-C src" "DESTDIR=$(out)/bin" ];
+  buildFlags = [ (if stdenv.isDarwin then "osx" else "linux-alsa") ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Programming language for real-time sound synthesis and music creation";
     homepage = http://chuck.cs.princeton.edu;
     license = licenses.gpl2;
diff --git a/pkgs/applications/misc/doomseeker/default.nix b/pkgs/applications/misc/doomseeker/default.nix
index 504ef78743c2..fd08ed9c3916 100644
--- a/pkgs/applications/misc/doomseeker/default.nix
+++ b/pkgs/applications/misc/doomseeker/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchFromBitbucket, pkgconfig, qtbase, qttools, qtmultimedia, zlib, bzip2 }:
+{ stdenv, cmake, fetchFromBitbucket, pkgconfig, qtbase, qttools, qtmultimedia, zlib, bzip2, xxd }:
 
 stdenv.mkDerivation rec {
   name = "doomseeker-${version}";
@@ -15,10 +15,12 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase qtmultimedia zlib bzip2 ];
 
-  nativeBuildInputs = [ cmake qttools pkgconfig ];
+  nativeBuildInputs = [ cmake qttools pkgconfig xxd ];
 
   enableParallelBuilding = true;
 
+  NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.cc.isClang "-Wno-error=format-security";
+
   meta = with stdenv.lib; {
     homepage = http://doomseeker.drdteam.org/;
     description = "Multiplayer server browser for many Doom source ports";
diff --git a/pkgs/applications/networking/sniffers/wireshark/cmake.patch b/pkgs/applications/networking/sniffers/wireshark/cmake.patch
deleted file mode 100644
index 890fffedce03..000000000000
--- a/pkgs/applications/networking/sniffers/wireshark/cmake.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -19,6 +19,7 @@
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- #
- 
-+cmake_minimum_required(VERSION 3.7)
- project(Wireshark C CXX)
- 
- # Updated by make-version.pl
-@@ -40,7 +41,7 @@
- 	# Needed for GREATER_EQUAL operator
- 	cmake_minimum_required(VERSION 3.7)
- else()
--	cmake_minimum_required(VERSION 2.8.8)
-+	cmake_minimum_required(VERSION 3.7)
- endif()
- 
- # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 850fdb0b715f..867768d9f9f1 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -49,8 +49,11 @@ in stdenv.mkDerivation {
       name = "fix-timeout.patch";
       url = "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff_plain;h=8b5b843fcbc3e03e0fc45f3caf8cf5fc477e8613;hp=94af9724d140fd132896b650d10c4d060788e4f0";
       sha256 = "1g2dm7lwsnanwp68b9xr9swspx7hfj4v3z44sz3yrfmynygk8zlv";
-    })
-    ++ stdenv.lib.optional stdenv.isDarwin ./cmake.patch;
+    });
+
+  postPatch = ''
+    sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
+  '';
 
   preBuild = ''
     export LD_LIBRARY_PATH="$PWD/run"
diff --git a/pkgs/development/libraries/libglvnd/default.nix b/pkgs/development/libraries/libglvnd/default.nix
index 7e1a2b549681..27c1cb0e390a 100644
--- a/pkgs/development/libraries/libglvnd/default.nix
+++ b/pkgs/development/libraries/libglvnd/default.nix
@@ -16,11 +16,18 @@ in stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkgconfig python2 ];
   buildInputs = [ libX11 libXext glproto ];
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/GLX/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+    substituteInPlace src/EGL/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+  '';
+
   NIX_CFLAGS_COMPILE = [
     "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS"
     # FHS paths are added so that non-NixOS applications can find vendor files.
     "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\""
-  ];
+  ] ++ lib.optional stdenv.cc.isClang "-Wno-error";
 
   # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268
   configureFlags  = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-tls";
@@ -40,6 +47,6 @@ in stdenv.mkDerivation rec {
     description = "The GL Vendor-Neutral Dispatch library";
     homepage = https://github.com/NVIDIA/libglvnd;
     license = licenses.bsd2;
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix
index 568e7ce07b3b..ec32c44a91fc 100644
--- a/pkgs/development/libraries/qca2/default.nix
+++ b/pkgs/development/libraries/qca2/default.nix
@@ -10,16 +10,23 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake pkgconfig ];
-  buildInputs = [ (stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security) qt ];
+  buildInputs = [ qt ]
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
 
   enableParallelBuilding = true;
 
   # tells CMake to use this CA bundle file if it is accessible
-  preConfigure = ''export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt'';
+  preConfigure = ''
+    export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt
+  '';
 
   # tricks CMake into using this CA bundle file if it is not accessible (in a sandbox)
   cmakeFlags = [ "-Dqca_CERTSTORE=/etc/ssl/certs/ca-certificates.crt" ];
 
+  postPatch = ''
+    sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
+  '';
+
   meta = with stdenv.lib; {
     description = "Qt Cryptographic Architecture";
     license = "LGPL";
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index 099794f6623d..2b9fa5cc04c0 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu
-, patchelf, coreutils, cctools
+, patchelf, coreutils, xcbuild
 , doCheck ? false
 , static ? false
 }:
@@ -124,13 +124,7 @@ stdenv.mkDerivation rec {
 
   # Patch based off of:
   # https://github.com/cowboyd/libv8/tree/v5.1.281.67.0/patches
-  patches = lib.optional (!doCheck) ./libv8-5.4.232.patch
-  ++ stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ];
-
-  prePatch = ''
-    chmod +w tools/gyp/pylib/gyp
-    chmod +w tools/gyp/pylib/gyp/xcode_emulation.py
-  '';
+  patches = lib.optional (!doCheck) ./libv8-5.4.232.patch;
 
   postPatch = ''
     sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' gypfiles/gyp_v8
@@ -157,7 +151,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ which ];
   buildInputs = [ readline python icu ]
-    ++ stdenv.lib.optional stdenv.isDarwin cctools
+    ++ stdenv.lib.optional stdenv.isDarwin xcbuild
     ++ stdenv.lib.optional stdenv.isLinux patchelf;
 
   NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow -Wno-error=unused-function -Wno-error=attributes"
diff --git a/pkgs/development/libraries/v8/no-xcode.patch b/pkgs/development/libraries/v8/no-xcode.patch
deleted file mode 100644
index 5562ffaf64e1..000000000000
--- a/pkgs/development/libraries/v8/no-xcode.patch
+++ /dev/null
@@ -1,64 +0,0 @@
---- a/tools/gyp/pylib/gyp/xcode_emulation.py
-+++ a/tools/gyp/pylib/gyp/xcode_emulation.py
-@@ -473,10 +473,16 @@
- 
-   def _XcodeSdkPath(self, sdk_root):
-     if sdk_root not in XcodeSettings._sdk_path_cache:
--      sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
--      XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
--      if sdk_root:
--        XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      try:
-+        sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
-+        XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
-+        if sdk_root:
-+          XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      except:
-+        # if this fails it's because xcodebuild failed, which means
-+        # the user is probably on a CLT-only system, where there
-+        # is no valid SDK root
-+        XcodeSettings._sdk_path_cache[sdk_root] = None
-     return XcodeSettings._sdk_path_cache[sdk_root]
- 
-   def _AppendPlatformVersionMinFlags(self, lst):
-@@ -606,10 +612,11 @@
-       framework_root = sdk_root
-     else:
-       framework_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
- 
-     self.configname = None
-     return cflags
-@@ -861,10 +868,11 @@
-     sdk_root = self._SdkPath()
-     if not sdk_root:
-       sdk_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
- 
-     platform_root = self._XcodePlatformPath(configname)
-     if sdk_root and platform_root and self._IsXCTest():
-@@ -1358,7 +1366,7 @@
-     if version:
-       version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
-     else:
--      raise GypError("No Xcode or CLT version detected!")
-+      version = "7.0.0"
-     # The CLT has no build information, so we return an empty string.
-     version_list = [version, '']
-   version = version_list[0]
diff --git a/pkgs/development/python-modules/Cython/default.nix b/pkgs/development/python-modules/Cython/default.nix
index fa07eee0d7e1..de5eaea842b2 100644
--- a/pkgs/development/python-modules/Cython/default.nix
+++ b/pkgs/development/python-modules/Cython/default.nix
@@ -48,6 +48,8 @@ in buildPythonPackage rec {
         ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"''}
   '';
 
+  doCheck = !stdenv.isDarwin;
+
   patches = [
     # The following is in GitHub in 0.28.3 but not in the `sdist`.
     # https://github.com/cython/cython/issues/2319
diff --git a/pkgs/development/python-modules/ldap/default.nix b/pkgs/development/python-modules/ldap/default.nix
index 17a6b158d3f2..09d399d25b37 100644
--- a/pkgs/development/python-modules/ldap/default.nix
+++ b/pkgs/development/python-modules/ldap/default.nix
@@ -1,6 +1,6 @@
 { buildPythonPackage, fetchPypi
 , pyasn1, pyasn1-modules, pytest
-, openldap, cyrus_sasl }:
+, openldap, cyrus_sasl, stdenv }:
 
 buildPythonPackage rec {
   pname = "python-ldap";
@@ -26,4 +26,6 @@ buildPythonPackage rec {
 
     py.test
   '';
+
+  doCheck = !stdenv.isDarwin;
 }
diff --git a/pkgs/development/python-modules/tqdm/default.nix b/pkgs/development/python-modules/tqdm/default.nix
index 0b77f7068012..fd5cd47be383 100644
--- a/pkgs/development/python-modules/tqdm/default.nix
+++ b/pkgs/development/python-modules/tqdm/default.nix
@@ -5,6 +5,7 @@
 , coverage
 , glibcLocales
 , flake8
+, stdenv
 }:
 
 buildPythonPackage rec {
@@ -26,6 +27,8 @@ buildPythonPackage rec {
 
   LC_ALL="en_US.UTF-8";
 
+  doCheck = !stdenv.isDarwin;
+
   meta = {
     description = "A Fast, Extensible Progress Meter";
     homepage = https://github.com/tqdm/tqdm;
diff --git a/pkgs/development/web/nodejs/no-xcode-v7.patch b/pkgs/development/web/nodejs/no-xcode-v7.patch
deleted file mode 100644
index 05623b21f13f..000000000000
--- a/pkgs/development/web/nodejs/no-xcode-v7.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
-index a173ff0..1fc821a 100644
---- a/tools/gyp/pylib/gyp/xcode_emulation.py
-+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
-@@ -507,9 +507,12 @@ class XcodeSettings(object):
-   def _XcodePlatformPath(self, configname=None):
-     sdk_root = self._SdkRoot(configname)
-     if sdk_root not in XcodeSettings._platform_path_cache:
--      platform_path = self._GetSdkVersionInfoItem(sdk_root,
-+      try:
-+        platform_path = self._GetSdkVersionInfoItem(sdk_root,
-                                                   '--show-sdk-platform-path')
--      XcodeSettings._platform_path_cache[sdk_root] = platform_path
-+        XcodeSettings._platform_path_cache[sdk_root] = platform_path
-+      except:
-+        XcodeSettings._platform_path_cache[sdk_root] = None
-     return XcodeSettings._platform_path_cache[sdk_root]
- 
-   def _SdkPath(self, configname=None):
-@@ -520,10 +523,13 @@ class XcodeSettings(object):
- 
-   def _XcodeSdkPath(self, sdk_root):
-     if sdk_root not in XcodeSettings._sdk_path_cache:
--      sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
--      XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
--      if sdk_root:
--        XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      try:
-+        sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
-+        XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
-+        if sdk_root:
-+          XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      except:
-+        XcodeSettings._sdk_path_cache[sdk_root] = None
-     return XcodeSettings._sdk_path_cache[sdk_root]
- 
-   def _AppendPlatformVersionMinFlags(self, lst):
-@@ -653,10 +659,11 @@ class XcodeSettings(object):
-       framework_root = sdk_root
-     else:
-       framework_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
- 
-     self.configname = None
-     return cflags
-@@ -908,10 +915,11 @@ class XcodeSettings(object):
-     sdk_root = self._SdkPath()
-     if not sdk_root:
-       sdk_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
- 
-     platform_root = self._XcodePlatformPath(configname)
-     if sdk_root and platform_root and self._IsXCTest():
-@@ -1683,6 +1691,9 @@ def _NormalizeEnvVarReferences(str):
-   """Takes a string containing variable references in the form ${FOO}, $(FOO),
-   or $FOO, and returns a string with all variable references in the form ${FOO}.
-   """
-+  if str is None:
-+    return ''
-+
-   # $FOO -> ${FOO}
-   str = re.sub(r'\$([a-zA-Z_][a-zA-Z0-9_]*)', r'${\1}', str)
- 
diff --git a/pkgs/development/web/nodejs/no-xcode.patch b/pkgs/development/web/nodejs/no-xcode.patch
deleted file mode 100644
index 27c9774ee6b1..000000000000
--- a/pkgs/development/web/nodejs/no-xcode.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
-index 407ead0..8bf64e7 100644
---- a/tools/gyp/pylib/gyp/xcode_emulation.py
-+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
-@@ -446,10 +446,16 @@ class XcodeSettings(object):
- 
-   def _XcodeSdkPath(self, sdk_root):
-     if sdk_root not in XcodeSettings._sdk_path_cache:
--      sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path')
--      XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
--      if sdk_root:
--        XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      try:
-+        sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path')
-+        XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
-+        if sdk_root:
-+          XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      except:
-+        # if this fails it's because xcodebuild failed, which means
-+        # the user is probably on a CLT-only system, where there
-+        # is no valid SDK root
-+        XcodeSettings._sdk_path_cache[sdk_root] = None
-     return XcodeSettings._sdk_path_cache[sdk_root]
- 
-   def _AppendPlatformVersionMinFlags(self, lst):
-@@ -572,10 +578,11 @@ class XcodeSettings(object):
-       framework_root = sdk_root
-     else:
-       framework_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
- 
-     self.configname = None
-     return cflags
-@@ -826,10 +833,11 @@ class XcodeSettings(object):
-     sdk_root = self._SdkPath()
-     if not sdk_root:
-       sdk_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
- 
-     is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension()
-     if sdk_root and is_extension:
diff --git a/pkgs/development/web/nodejs/no-xcodebuild.patch b/pkgs/development/web/nodejs/no-xcodebuild.patch
deleted file mode 100644
index 94184152a03b..000000000000
--- a/pkgs/development/web/nodejs/no-xcodebuild.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -Naur node-v8.9.4/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py node-v8.9.4-new/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
---- node-v8.9.4/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py	2018-01-03 03:34:44.000000000 +0100
-+++ node-v8.9.4-new/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py	2018-03-12 11:15:37.972537585 +0100
-@@ -1251,7 +1251,8 @@
-   if XCODE_VERSION_CACHE:
-     return XCODE_VERSION_CACHE
-   try:
--    version_list = GetStdout(['xcodebuild', '-version']).splitlines()
-+    #version_list = GetStdout(['xcodebuild', '-version']).splitlines()
-+    version_list = ['Xcode 9.2', 'Build version 9C40b']
-     # In some circumstances xcodebuild exits 0 but doesn't return
-     # the right results; for example, a user on 10.7 or 10.8 with
-     # a bogus path set via xcode-select
diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix
index 3f0ab5ff5067..aec2778fd781 100644
--- a/pkgs/development/web/nodejs/nodejs.nix
+++ b/pkgs/development/web/nodejs/nodejs.nix
@@ -3,19 +3,17 @@
 # Updater dependencies
 , writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts, nix
 , gnupg
-, darwin ? null
+, darwin, xcbuild
 }:
 
 with stdenv.lib;
 
-{ enableNpm ? true, version, sha256, patches } @args:
+{ enableNpm ? true, version, sha256, patches ? [] } @args:
 
 let
 
   inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
 
-
-
   baseName = if enableNpm then "nodejs" else "nodejs-slim";
 
   sharedLibDeps = { inherit openssl zlib libuv; } // (optionalAttrs (!stdenv.isDarwin) { inherit http-parser; });
@@ -48,9 +46,10 @@ in
     };
 
     buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
-    ++ [ python2 which zlib libuv openssl ]
-    ++ optionals stdenv.isLinux [ utillinux http-parser ]
-    ++ optionals stdenv.isDarwin [ pkgconfig darwin.cctools ];
+      ++ [ python2 zlib libuv openssl http-parser ];
+
+    nativeBuildInputs = [ which utillinux ]
+      ++ optionals stdenv.isDarwin [ pkgconfig xcbuild ];
 
     configureFlags = sharedConfigureFlags ++ [ "--without-dtrace" ] ++ extraConfigFlags;
 
@@ -73,7 +72,6 @@ in
 
     prePatch = ''
       patchShebangs .
-      sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py
     '';
 
     postInstall = ''
diff --git a/pkgs/development/web/nodejs/v10.nix b/pkgs/development/web/nodejs/v10.nix
index d3746f123d3d..1d307c77f9fb 100644
--- a/pkgs/development/web/nodejs/v10.nix
+++ b/pkgs/development/web/nodejs/v10.nix
@@ -7,5 +7,4 @@ in
     inherit enableNpm;
     version = "10.7.0";
     sha256 = "0qp93ddbnvadimj11wnznwhkq8vq1f7q259iq8siy5b7r936kvil";
-    patches = lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ./no-xcodebuild.patch ];
   }
diff --git a/pkgs/development/web/nodejs/v6.nix b/pkgs/development/web/nodejs/v6.nix
index 8eb05d67f088..2e94923441fc 100644
--- a/pkgs/development/web/nodejs/v6.nix
+++ b/pkgs/development/web/nodejs/v6.nix
@@ -7,5 +7,4 @@ in
     inherit enableNpm;
     version = "6.14.3";
     sha256 = "1jbrfk875aimm65wni059rrydmhp4z0hrxskq3ci6jvykxr8gwg3";
-    patches = lib.optionals stdenv.isDarwin [ ./no-xcode.patch ./no-xcodebuild.patch ];
   }
diff --git a/pkgs/development/web/nodejs/v8.nix b/pkgs/development/web/nodejs/v8.nix
index 9410f017a9c3..288debb72f6c 100644
--- a/pkgs/development/web/nodejs/v8.nix
+++ b/pkgs/development/web/nodejs/v8.nix
@@ -7,5 +7,4 @@ in
     inherit enableNpm;
     version = "8.11.3";
     sha256 = "1q3fc791ng1sgk0i5qnxpxri7235nkjm50zx1z34c759vhgpaz2p";
-    patches = lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ./no-xcodebuild.patch ];
   }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1ec8cde2e1ad..e7820b8d39cc 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12204,7 +12204,6 @@ with pkgs;
 
   v8 = callPackage ../development/libraries/v8 ({
     inherit (python2Packages) python gyp;
-    cctools = darwin.cctools;
     icu = icu58; # v8-5.4.232 fails against icu4c-59.1
   } // lib.optionalAttrs stdenv.isLinux {
     # doesn't build with gcc7