1{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser 2, pkgconfig, runCommand, which, libtool 3}: 4 5# nodejs 0.12 can't be built on armv5tel. Armv6 with FPU, minimum I think. 6# Related post: http://zo0ok.com/techfindings/archives/1820 7assert stdenv.system != "armv5tel-linux"; 8 9let 10 version = "4.3.0"; 11 12 deps = { 13 inherit openssl zlib libuv; 14 15 # disabled system v8 because v8 3.14 no longer receives security fixes 16 # we fall back to nodejs' internal v8 copy which receives backports for now 17 # inherit v8 18 } // (stdenv.lib.optionalAttrs (!stdenv.isDarwin) { 19 inherit http-parser; 20 }); 21 22 sharedConfigureFlags = name: [ 23 "--shared-${name}" 24 "--shared-${name}-includes=${builtins.getAttr name deps}/include" 25 "--shared-${name}-libpath=${builtins.getAttr name deps}/lib" 26 ]; 27 28 inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms; 29in stdenv.mkDerivation { 30 name = "nodejs-${version}"; 31 32 src = fetchurl { 33 url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz"; 34 sha256 = "1f86jy71mi01g4xd411l5w8pi80nlk6sz7d2c0ghdk83v734ll0q"; 35 }; 36 37 configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ]; 38 dontDisableStatic = true; 39 prePatch = '' 40 patchShebangs . 41 sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py 42 ''; 43 44 patches = stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ]; 45 46 postFixup = '' 47 sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' $out/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py 48 ''; 49 50 buildInputs = [ python which zlib libuv openssl python ] 51 ++ optionals stdenv.isLinux [ utillinux http-parser ] 52 ++ optionals stdenv.isDarwin [ pkgconfig openssl libtool ]; 53 setupHook = ./setup-hook.sh; 54 55 enableParallelBuilding = true; 56 57 passthru.interpreterName = "nodejs"; 58 59 meta = { 60 description = "Event-driven I/O framework for the V8 JavaScript engine"; 61 homepage = http://nodejs.org; 62 license = licenses.mit; 63 maintainers = [ maintainers.havvy ]; 64 platforms = platforms.linux ++ platforms.darwin; 65 }; 66}