Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00

127 lines
3.5 KiB
Nix

{
stdenv,
lib,
fetchurl,
zlib,
curl,
xz,
patchelf,
runtimeShell,
}:
let
version = "2.7.3";
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 = "sha256-ovsE7jUJIKf96WEoITXECUlPo+o1tEKvHzCc7Xgj614=";
};
x86_64-darwin = fetchurl {
url = "https://static-meteor.netdna-ssl.com/packages-bootstrap/${version}/meteor-bootstrap-os.osx.x86_64.tar.gz";
sha256 = "11206dbda50a680fdab7044def7ea68ea8f4a9bca948ca56df91fe1392b2ac16";
};
};
in
stdenv.mkDerivation {
inherit version;
pname = "meteor";
src = srcs.${system} or (throw "unsupported system ${system}");
#dontStrip = true;
sourceRoot = ".meteor";
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
#!${runtimeShell}
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
$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.hostPlatform.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
curl
xz
]
}" \
--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):${lib.getLib stdenv.cc.cc}/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
curl
xz
]
}" \
$p
done
# Patch node dlls.
for p in $(find $out/packages -name '*.node'); do
patchelf \
--set-rpath "$(patchelf --print-rpath $p):${lib.getLib stdenv.cc.cc}/lib" \
$p || true
done
'';
meta = with lib; {
description = "Complete open source platform for building web and mobile apps in pure JavaScript";
homepage = "https://www.meteor.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.mit;
platforms = builtins.attrNames srcs;
maintainers = [ ];
mainProgram = "meteor";
};
}