summary refs log tree commit diff
path: root/pkgs/servers/meteor
diff options
context:
space:
mode:
authorNikolay Korotkiy <sikmir@gmail.com>2020-07-22 02:26:15 +0300
committerNikolay Korotkiy <sikmir@gmail.com>2021-01-05 20:01:48 +0300
commit6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52 (patch)
treed5c0b641737cbaa757130fc117ea240264992dc8 /pkgs/servers/meteor
parent9dd4ddac2f6aca666250e4848b91698878a0652c (diff)
downloadnixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar.gz
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar.bz2
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar.lz
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar.xz
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.tar.zst
nixpkgs-6403ffe2e1f2f27e49f0cd61406fc9a3c3e06a52.zip
meteor: enable on darwin
Diffstat (limited to 'pkgs/servers/meteor')
-rw-r--r--pkgs/servers/meteor/default.nix87
1 files changed, 49 insertions, 38 deletions
diff --git a/pkgs/servers/meteor/default.nix b/pkgs/servers/meteor/default.nix
index 96363583b62..ac870a8d5d1 100644
--- a/pkgs/servers/meteor/default.nix
+++ b/pkgs/servers/meteor/default.nix
@@ -2,15 +2,25 @@
 
 let
   version = "1.12";
+
+  inherit (stdenv.hostPlatform) system;
+
+  srcs = {
+    x86_64-linux = fetchurl {
+      url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.linux.x86_64.tar.gz";
+      sha256 = "0l3zc76djzypvc0dm5ikv5ybb6574qd6kdbbkarzc2dxx64wkyvb";
+    };
+    x86_64-darwin = fetchurl {
+      url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.osx.x86_64.tar.gz";
+      sha256 = "01gn3m6qacp3ibvp0rcvm2pq7fi1xds02ws0irypldh7vz3930jl";
+    };
+  };
 in
 
 stdenv.mkDerivation {
   inherit version;
   pname = "meteor";
-  src = fetchurl {
-    url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.linux.x86_64.tar.gz";
-    sha256 = "0l3zc76djzypvc0dm5ikv5ybb6574qd6kdbbkarzc2dxx64wkyvb";
-  };
+  src = srcs.${system};
 
   #dontStrip = true;
 
@@ -30,38 +40,6 @@ stdenv.mkDerivation {
     toolsDir=$(dirname $(find $out/packages -print | grep "meteor-tool/.*/tools/index.js$"))
     ln -s $toolsDir $out/tools
 
-    # Patch Meteor to dynamically fixup shebangs and ELF metadata where
-    # necessary.
-    pushd $out
-    patch -p1 < ${./main.patch}
-    popd
-    substituteInPlace $out/tools/cli/main.js \
-      --replace "@INTERPRETER@" "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-      --replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \
-      --replace "@PATCHELF@" "${patchelf}/bin/patchelf"
-
-    # Patch node.
-    node=$devBundle/bin/node
-    patchelf \
-      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
-      --set-rpath "$(patchelf --print-rpath $node):${stdenv.cc.cc.lib}/lib" \
-      $node
-
-    # Patch mongo.
-    for p in $devBundle/mongodb/bin/mongo{,d}; do
-      patchelf \
-        --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
-        --set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \
-        $p
-    done
-
-    # Patch node dlls.
-    for p in $(find $out/packages -name '*.node'); do
-      patchelf \
-        --set-rpath "$(patchelf --print-rpath $p):${stdenv.cc.cc.lib}/lib" \
-        $p || true
-    done
-
     # Meteor needs an initial package-metadata in $HOME/.meteor,
     # otherwise it fails spectacularly.
     mkdir -p $out/bin
@@ -75,16 +53,49 @@ stdenv.mkDerivation {
       chmod +w "\$HOME/.meteor/package-metadata/v2.0.1/packages.data.db"
     fi
 
-    $node \''${TOOL_NODE_FLAGS} $out/tools/index.js "\$@"
+    $out/dev_bundle/bin/node --no-wasm-code-gc \''${TOOL_NODE_FLAGS} $out/tools/index.js "\$@"
     EOF
     chmod +x $out/bin/meteor
   '';
 
+  postFixup = lib.optionalString stdenv.isLinux ''
+      # Patch Meteor to dynamically fixup shebangs and ELF metadata where
+      # necessary.
+      pushd $out
+      patch -p1 < ${./main.patch}
+      popd
+      substituteInPlace $out/tools/cli/main.js \
+        --replace "@INTERPRETER@" "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+        --replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \
+        --replace "@PATCHELF@" "${patchelf}/bin/patchelf"
+
+      # Patch node.
+      patchelf \
+        --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+        --set-rpath "$(patchelf --print-rpath $out/dev_bundle/bin/node):${stdenv.cc.cc.lib}/lib" \
+        $out/dev_bundle/bin/node
+
+      # Patch mongo.
+      for p in $out/dev_bundle/mongodb/bin/mongo{,d}; do
+        patchelf \
+          --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+          --set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \
+          $p
+      done
+
+      # Patch node dlls.
+      for p in $(find $out/packages -name '*.node'); do
+        patchelf \
+          --set-rpath "$(patchelf --print-rpath $p):${stdenv.cc.cc.lib}/lib" \
+          $p || true
+      done
+  '';
+
   meta = with lib; {
     description = "Complete open source platform for building web and mobile apps in pure JavaScript";
     homepage = "http://www.meteor.com";
     license = licenses.mit;
-    platforms = [ "x86_64-linux" ];
+    platforms = builtins.attrNames srcs;
     maintainers = with maintainers; [ cstrahan ];
   };
 }