summary refs log tree commit diff
path: root/pkgs/development/web/nodejs/nodejs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/web/nodejs/nodejs.nix')
-rw-r--r--pkgs/development/web/nodejs/nodejs.nix37
1 files changed, 24 insertions, 13 deletions
diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix
index 3f0ab5ff506..b2ee7528814 100644
--- a/pkgs/development/web/nodejs/nodejs.nix
+++ b/pkgs/development/web/nodejs/nodejs.nix
@@ -3,19 +3,18 @@
 # Updater dependencies
 , writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts, nix
 , gnupg
-, darwin ? null
+, darwin, xcbuild
+, procps
 }:
 
 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 +47,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;
 
@@ -66,16 +66,27 @@ in
 
     inherit patches;
 
-    preBuild = optionalString stdenv.isDarwin ''
-      sed -i -e "s|tr1/type_traits|type_traits|g" \
-      -e "s|std::tr1|std|" src/util.h
-    '';
-
-    prePatch = ''
+    postPatch = ''
       patchShebangs .
       sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py
+
+      # fix tests
+      for a in test/parallel/test-child-process-env.js \
+               test/parallel/test-child-process-exec-env.js \
+               test/parallel/test-child-process-default-options.js \
+               test/fixtures/syntax/good_syntax_shebang.js \
+               test/fixtures/syntax/bad_syntax_shebang.js ; do
+        substituteInPlace $a \
+          --replace "/usr/bin/env" "${coreutils}/bin/env"
+      done
+    '' + optionalString stdenv.isDarwin ''
+      sed -i -e "s|tr1/type_traits|type_traits|g" \
+             -e "s|std::tr1|std|" src/util.h
     '';
 
+    checkInputs = [ procps ];
+    doCheck = false; # fails 4 out of 1453 tests
+
     postInstall = ''
       paxmark m $out/bin/node
       PATH=$out/bin:$PATH patchShebangs $out