2023-04-26 10:44:21 +00:00
|
|
|
{ stdenv, lib, fetchurl, zlib, curl, xz, patchelf, runtimeShell }:
|
2015-09-25 10:00:16 +00:00
|
|
|
|
|
|
|
let
|
2022-08-18 00:11:59 +00:00
|
|
|
version = "2.7.3";
|
2020-07-21 23:26:15 +00:00
|
|
|
|
|
|
|
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";
|
2022-08-18 00:11:59 +00:00
|
|
|
sha256 = "sha256-ovsE7jUJIKf96WEoITXECUlPo+o1tEKvHzCc7Xgj614=";
|
2020-07-21 23:26:15 +00:00
|
|
|
};
|
|
|
|
x86_64-darwin = fetchurl {
|
|
|
|
url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.osx.x86_64.tar.gz";
|
2022-08-18 00:11:59 +00:00
|
|
|
sha256 = "11206dbda50a680fdab7044def7ea68ea8f4a9bca948ca56df91fe1392b2ac16";
|
2020-07-21 23:26:15 +00:00
|
|
|
};
|
|
|
|
};
|
2015-09-25 10:00:16 +00:00
|
|
|
in
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-08-09 18:51:02 +00:00
|
|
|
inherit version;
|
|
|
|
pname = "meteor";
|
2020-07-21 23:26:15 +00:00
|
|
|
src = srcs.${system};
|
2015-09-25 10:00:16 +00:00
|
|
|
|
2019-08-09 18:51:02 +00:00
|
|
|
#dontStrip = true;
|
2015-09-25 10:00:16 +00:00
|
|
|
|
2019-08-09 18:51:02 +00:00
|
|
|
sourceRoot = ".meteor";
|
2015-09-25 10:00:16 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
|
|
|
|
cp -r packages $out
|
|
|
|
chmod -R +w $out/packages
|
|
|
|
|
|
|
|
cp -r package-metadata $out
|
|
|
|
|
|
|
|
devBundle=$(find $out/packages/meteor-tool -name dev_bundle)
|
|
|
|
ln -s $devBundle $out/dev_bundle
|
|
|
|
|
|
|
|
toolsDir=$(dirname $(find $out/packages -print | grep "meteor-tool/.*/tools/index.js$"))
|
|
|
|
ln -s $toolsDir $out/tools
|
|
|
|
|
|
|
|
# Meteor needs an initial package-metadata in $HOME/.meteor,
|
|
|
|
# otherwise it fails spectacularly.
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat << EOF > $out/bin/meteor
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2015-09-25 10:00:16 +00:00
|
|
|
|
|
|
|
if [[ ! -f \$HOME/.meteor/package-metadata/v2.0.1/packages.data.db ]]; then
|
|
|
|
mkdir -p \$HOME/.meteor/package-metadata/v2.0.1
|
|
|
|
cp $out/package-metadata/v2.0.1/packages.data.db "\$HOME/.meteor/package-metadata/v2.0.1"
|
|
|
|
chown "\$(whoami)" "\$HOME/.meteor/package-metadata/v2.0.1/packages.data.db"
|
|
|
|
chmod +w "\$HOME/.meteor/package-metadata/v2.0.1/packages.data.db"
|
|
|
|
fi
|
|
|
|
|
2020-07-21 23:26:15 +00:00
|
|
|
$out/dev_bundle/bin/node --no-wasm-code-gc \''${TOOL_NODE_FLAGS} $out/tools/index.js "\$@"
|
2015-09-25 10:00:16 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/meteor
|
|
|
|
'';
|
|
|
|
|
2020-07-21 23:26:15 +00:00
|
|
|
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)" \
|
2023-04-26 10:44:21 +00:00
|
|
|
--replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib curl xz ]}" \
|
2020-07-21 23:26:15 +00:00
|
|
|
--replace "@PATCHELF@" "${patchelf}/bin/patchelf"
|
2022-08-18 00:12:18 +00:00
|
|
|
|
2020-07-21 23:26:15 +00:00
|
|
|
# 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
|
2022-08-18 00:12:18 +00:00
|
|
|
|
2020-07-21 23:26:15 +00:00
|
|
|
# Patch mongo.
|
|
|
|
for p in $out/dev_bundle/mongodb/bin/mongo{,d}; do
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
2023-04-26 10:44:21 +00:00
|
|
|
--set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib curl xz ]}" \
|
2020-07-21 23:26:15 +00:00
|
|
|
$p
|
|
|
|
done
|
2022-08-18 00:12:18 +00:00
|
|
|
|
2020-07-21 23:26:15 +00:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2015-09-25 10:00:16 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Complete open source platform for building web and mobile apps in pure JavaScript";
|
2021-12-31 18:49:04 +00:00
|
|
|
homepage = "https://www.meteor.com/";
|
2022-06-11 11:39:29 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2015-09-25 10:00:16 +00:00
|
|
|
license = licenses.mit;
|
2020-07-21 23:26:15 +00:00
|
|
|
platforms = builtins.attrNames srcs;
|
2015-09-25 10:00:16 +00:00
|
|
|
maintainers = with maintainers; [ cstrahan ];
|
|
|
|
};
|
|
|
|
}
|