meteor: enable on darwin

+49 -38
+49 -38
pkgs/servers/meteor/default.nix
··· 2 2 3 3 let 4 4 version = "1.12"; 5 + 6 + inherit (stdenv.hostPlatform) system; 7 + 8 + srcs = { 9 + x86_64-linux = fetchurl { 10 + url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.linux.x86_64.tar.gz"; 11 + sha256 = "0l3zc76djzypvc0dm5ikv5ybb6574qd6kdbbkarzc2dxx64wkyvb"; 12 + }; 13 + x86_64-darwin = fetchurl { 14 + url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.osx.x86_64.tar.gz"; 15 + sha256 = "01gn3m6qacp3ibvp0rcvm2pq7fi1xds02ws0irypldh7vz3930jl"; 16 + }; 17 + }; 5 18 in 6 19 7 20 stdenv.mkDerivation { 8 21 inherit version; 9 22 pname = "meteor"; 10 - src = fetchurl { 11 - url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.linux.x86_64.tar.gz"; 12 - sha256 = "0l3zc76djzypvc0dm5ikv5ybb6574qd6kdbbkarzc2dxx64wkyvb"; 13 - }; 23 + src = srcs.${system}; 14 24 15 25 #dontStrip = true; 16 26 ··· 30 40 toolsDir=$(dirname $(find $out/packages -print | grep "meteor-tool/.*/tools/index.js$")) 31 41 ln -s $toolsDir $out/tools 32 42 33 - # Patch Meteor to dynamically fixup shebangs and ELF metadata where 34 - # necessary. 35 - pushd $out 36 - patch -p1 < ${./main.patch} 37 - popd 38 - substituteInPlace $out/tools/cli/main.js \ 39 - --replace "@INTERPRETER@" "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 40 - --replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ 41 - --replace "@PATCHELF@" "${patchelf}/bin/patchelf" 42 - 43 - # Patch node. 44 - node=$devBundle/bin/node 45 - patchelf \ 46 - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 47 - --set-rpath "$(patchelf --print-rpath $node):${stdenv.cc.cc.lib}/lib" \ 48 - $node 49 - 50 - # Patch mongo. 51 - for p in $devBundle/mongodb/bin/mongo{,d}; do 52 - patchelf \ 53 - --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 54 - --set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ 55 - $p 56 - done 57 - 58 - # Patch node dlls. 59 - for p in $(find $out/packages -name '*.node'); do 60 - patchelf \ 61 - --set-rpath "$(patchelf --print-rpath $p):${stdenv.cc.cc.lib}/lib" \ 62 - $p || true 63 - done 64 - 65 43 # Meteor needs an initial package-metadata in $HOME/.meteor, 66 44 # otherwise it fails spectacularly. 67 45 mkdir -p $out/bin ··· 75 53 chmod +w "\$HOME/.meteor/package-metadata/v2.0.1/packages.data.db" 76 54 fi 77 55 78 - $node \''${TOOL_NODE_FLAGS} $out/tools/index.js "\$@" 56 + $out/dev_bundle/bin/node --no-wasm-code-gc \''${TOOL_NODE_FLAGS} $out/tools/index.js "\$@" 79 57 EOF 80 58 chmod +x $out/bin/meteor 81 59 ''; 82 60 61 + postFixup = lib.optionalString stdenv.isLinux '' 62 + # Patch Meteor to dynamically fixup shebangs and ELF metadata where 63 + # necessary. 64 + pushd $out 65 + patch -p1 < ${./main.patch} 66 + popd 67 + substituteInPlace $out/tools/cli/main.js \ 68 + --replace "@INTERPRETER@" "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 69 + --replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ 70 + --replace "@PATCHELF@" "${patchelf}/bin/patchelf" 71 + 72 + # Patch node. 73 + patchelf \ 74 + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 75 + --set-rpath "$(patchelf --print-rpath $out/dev_bundle/bin/node):${stdenv.cc.cc.lib}/lib" \ 76 + $out/dev_bundle/bin/node 77 + 78 + # Patch mongo. 79 + for p in $out/dev_bundle/mongodb/bin/mongo{,d}; do 80 + patchelf \ 81 + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 82 + --set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ 83 + $p 84 + done 85 + 86 + # Patch node dlls. 87 + for p in $(find $out/packages -name '*.node'); do 88 + patchelf \ 89 + --set-rpath "$(patchelf --print-rpath $p):${stdenv.cc.cc.lib}/lib" \ 90 + $p || true 91 + done 92 + ''; 93 + 83 94 meta = with lib; { 84 95 description = "Complete open source platform for building web and mobile apps in pure JavaScript"; 85 96 homepage = "http://www.meteor.com"; 86 97 license = licenses.mit; 87 - platforms = [ "x86_64-linux" ]; 98 + platforms = builtins.attrNames srcs; 88 99 maintainers = with maintainers; [ cstrahan ]; 89 100 }; 90 101 }