at 16.09-beta 1.9 kB view raw
1{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser 2, pkgconfig, runCommand, which, libtool 3, version 4, sha256 ? null 5, src ? fetchurl { url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz"; inherit sha256; } 6, preBuild ? "" 7, extraConfigFlags ? [] 8, extraBuildInputs ? [] 9, ... 10}: 11 12assert stdenv.system != "armv5tel-linux"; 13 14let 15 16 deps = { 17 inherit openssl zlib libuv; 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; 29 30in stdenv.mkDerivation { 31 32 inherit version src preBuild; 33 34 name = "nodejs-${version}"; 35 36 configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ] ++ extraConfigFlags; 37 dontDisableStatic = true; 38 prePatch = '' 39 patchShebangs . 40 sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py 41 ''; 42 43 postInstall = '' 44 PATH=$out/bin:$PATH patchShebangs $out 45 ''; 46 47 patches = stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ]; 48 49 buildInputs = extraBuildInputs 50 ++ [ python which zlib libuv openssl ] 51 ++ optionals stdenv.isLinux [ utillinux http-parser ] 52 ++ optionals stdenv.isDarwin [ pkgconfig 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.goibhniu maintainers.havvy maintainers.gilligan maintainers.cko ]; 64 platforms = platforms.linux ++ platforms.darwin; 65 }; 66}