summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/web/nodejs/nodejs.nix92
-rw-r--r--pkgs/development/web/nodejs/v4.nix27
-rw-r--r--pkgs/development/web/nodejs/v6.nix37
-rw-r--r--pkgs/top-level/all-packages.nix16
4 files changed, 94 insertions, 78 deletions
diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix
index 7c92df30311..236688bd463 100644
--- a/pkgs/development/web/nodejs/nodejs.nix
+++ b/pkgs/development/web/nodejs/nodejs.nix
@@ -1,67 +1,65 @@
 { stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
-, pkgconfig, runCommand, which, libtool
-, version
-, sha256 ? null
-, src ? fetchurl { url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz"; inherit sha256; }
-, preBuild ? ""
-, extraConfigFlags ? []
-, extraBuildInputs ? []
-, patches ? [],
- ...
+, pkgconfig, runCommand, which, libtool, fetchpatch
+, callPackage
+, darwin ? null
+, enableNpm ? true
 }:
 
-assert stdenv.system != "armv5tel-linux";
+with stdenv.lib;
 
 let
 
-  deps = {
-    inherit openssl zlib libuv;
-  } // (stdenv.lib.optionalAttrs (!stdenv.isDarwin) {
-    inherit http-parser;
-  });
+  inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
 
-  sharedConfigureFlags = name: [
+  sharedLibDeps = { inherit openssl zlib libuv; } // (optionalAttrs (!stdenv.isDarwin) { inherit http-parser; });
+
+  sharedConfigureFlags = concatMap (name: [
     "--shared-${name}"
-    "--shared-${name}-includes=${builtins.getAttr name deps}/include"
-    "--shared-${name}-libpath=${builtins.getAttr name deps}/lib"
-  ];
+    "--shared-${name}-libpath=${getLib sharedLibDeps.${name}}/lib"
+  ]) (builtins.attrNames sharedLibDeps);
 
-  inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms;
+  extraConfigFlags = optionals (!enableNpm) [ "--without-npm" ];
+in
 
-in stdenv.mkDerivation {
+  rec {
 
-  inherit version src preBuild;
+    buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
+    ++ [ python2 which zlib libuv openssl ]
+    ++ optionals stdenv.isLinux [ utillinux http-parser ]
+    ++ optionals stdenv.isDarwin [ pkgconfig libtool ];
 
-  name = "nodejs-${version}";
+    configureFlags = sharedConfigureFlags ++ [ "--without-dtrace" ] ++ extraConfigFlags;
 
-  configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ] ++ extraConfigFlags;
-  dontDisableStatic = true;
-  prePatch = ''
-    patchShebangs .
-    sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py
-  '';
+    dontDisableStatic = true;
 
-  postInstall = ''
-    PATH=$out/bin:$PATH patchShebangs $out
-  '';
+    enableParallelBuilding = true;
 
-  patches = patches ++ stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ];
+    passthru.interpreterName = "nodejs";
 
-  buildInputs = extraBuildInputs
-    ++ [ python2 which zlib libuv openssl ]
-    ++ optionals stdenv.isLinux [ utillinux http-parser ]
-    ++ optionals stdenv.isDarwin [ pkgconfig libtool ];
-  setupHook = ./setup-hook.sh;
 
-  enableParallelBuilding = true;
+    setupHook = ./setup-hook.sh;
+
+    patches = optionals stdenv.isDarwin [ ./no-xcode.patch ];
+
+    preBuild = optionalString stdenv.isDarwin ''
+      sed -i -e "s|tr1/type_traits|type_traits|g" \
+      -e "s|std::tr1|std|" src/util.h
+    '';
+
+    prePatch = ''
+      patchShebangs .
+      sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py
+    '';
 
-  passthru.interpreterName = "nodejs";
+    postInstall = ''
+      PATH=$out/bin:$PATH patchShebangs $out
+    '';
 
-  meta = {
-    description = "Event-driven I/O framework for the V8 JavaScript engine";
-    homepage = http://nodejs.org;
-    license = licenses.mit;
-    maintainers = [ maintainers.goibhniu maintainers.havvy maintainers.gilligan maintainers.cko ];
-    platforms = platforms.linux ++ platforms.darwin;
-  };
+    meta = {
+      description = "Event-driven I/O framework for the V8 JavaScript engine";
+      homepage = http://nodejs.org;
+      license = licenses.mit;
+      maintainers = with maintainers; [ goibhniu havvy gilligan cko ];
+      platforms = platforms.linux ++ platforms.darwin;
+    };
 }
diff --git a/pkgs/development/web/nodejs/v4.nix b/pkgs/development/web/nodejs/v4.nix
index f0a505a683a..04ea7086f74 100644
--- a/pkgs/development/web/nodejs/v4.nix
+++ b/pkgs/development/web/nodejs/v4.nix
@@ -1,17 +1,20 @@
 { stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
-, pkgconfig, runCommand, which, libtool
+, pkgconfig, runCommand, which, libtool, fetchpatch
 , callPackage
+, darwin ? null
+, enableNpm ? true
 }@args:
 
-import ./nodejs.nix (args // rec {
-  version = "4.6.0";
-  src = fetchurl {
-    url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
-    sha256 = "1566q1kkv8j30fgqx8sm2h8323f38wwpa1hfb10gr6z46jyhv4a2";
-  };
+let
+  nodejs = import ./nodejs.nix args;
+  baseName = if enableNpm then "nodejs" else "nodejs-slim";
+in
+  stdenv.mkDerivation (nodejs // rec {
+    version = "4.6.0";
+    name = "${baseName}-${version}";
+    src = fetchurl {
+      url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
+      sha256 = "1566q1kkv8j30fgqx8sm2h8323f38wwpa1hfb10gr6z46jyhv4a2";
+    };
 
-  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace src/util.h \
-      --replace "tr1/type_traits" "type_traits"
-  '';
-})
+  })
diff --git a/pkgs/development/web/nodejs/v6.nix b/pkgs/development/web/nodejs/v6.nix
index a2213546ec4..50bd2cb672e 100644
--- a/pkgs/development/web/nodejs/v6.nix
+++ b/pkgs/development/web/nodejs/v6.nix
@@ -2,24 +2,27 @@
 , pkgconfig, runCommand, which, libtool, fetchpatch
 , callPackage
 , darwin ? null
+, enableNpm ? true
 }@args:
 
 let
-  inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
+  nodejs = import ./nodejs.nix args;
+  baseName = if enableNpm then "nodejs" else "nodejs-slim";
+in
+  stdenv.mkDerivation (nodejs // rec {
+    version = "6.8.0";
+    name = "${baseName}-${version}";
+    src = fetchurl {
+      url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz";
+      sha256 = "13arzwki13688hr1lh871y06lrk019g4hkasmg11arm8j1dcwcpq";
+    };
+
+    patches = nodejs.patches ++ [
+      (fetchpatch {
+        url = "https://github.com/nodejs/node/commit/fc164acbbb700fd50ab9c04b47fc1b2687e9c0f4.patch";
+        sha256 = "1rms3n09622xmddn013yvf5c6p3s8w8s0d2h813zs8c1l15k4k1i";
+      })
+    ];
+
+  })
 
-in import ./nodejs.nix (args // rec {
-  version = "6.8.0";
-  sha256 = "13arzwki13688hr1lh871y06lrk019g4hkasmg11arm8j1dcwcpq";
-  extraBuildInputs = stdenv.lib.optionals stdenv.isDarwin
-    [ CoreServices ApplicationServices ];
-  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
-    sed -i -e "s|tr1/type_traits|type_traits|g" \
-      -e "s|std::tr1|std|" src/util.h
-  '';
-  patches = [
-    (fetchpatch {
-      url = "https://github.com/nodejs/node/commit/fc164acbbb700fd50ab9c04b47fc1b2687e9c0f4.patch";
-      sha256 = "1rms3n09622xmddn013yvf5c6p3s8w8s0d2h813zs8c1l15k4k1i";
-    })
-  ];
-})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a3c86782db7..4e0efdfe5a5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2426,15 +2426,27 @@ in
 
   ninka = callPackage ../development/tools/misc/ninka { };
 
+  nodejs = nodejs-6_x;
+
+  nodejs-slim = nodejs-slim-6_x;
+
   nodejs-4_x = callPackage ../development/web/nodejs/v4.nix {
     libtool = darwin.cctools;
   };
 
+  nodejs-slim-4_x = callPackage ../development/web/nodejs/v4.nix {
+    libtool = darwin.cctools;
+    enableNpm = false;
+  };
+
   nodejs-6_x = callPackage ../development/web/nodejs/v6.nix {
     libtool = darwin.cctools;
   };
 
-  nodejs = nodejs-6_x;
+  nodejs-slim-6_x = callPackage ../development/web/nodejs/v6.nix {
+    libtool = darwin.cctools;
+    enableNpm = false;
+  };
 
   nodePackages_6_x = callPackage ../development/node-packages/default-v6.nix {
     nodejs = pkgs.nodejs-6_x;
@@ -2444,7 +2456,7 @@ in
     nodejs = pkgs.nodejs-4_x;
   };
 
-  nodePackages = nodePackages_4_x;
+  nodePackages = nodePackages_6_x;
 
   # Can be used as a user shell
   nologin = shadow;