mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
mongosh: 2.4.2 -> 2.5.1, build from source, disable telemetry by default
This commit is contained in:
parent
9cbcbeec98
commit
d169c89e07
5 changed files with 55 additions and 6080 deletions
13
pkgs/by-name/mo/mongosh/disable-telemetry.patch
Normal file
13
pkgs/by-name/mo/mongosh/disable-telemetry.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/packages/cli-repl/src/cli-repl.ts b/packages/cli-repl/src/cli-repl.ts
|
||||||
|
index b00c52e1..7a096d6d 100644
|
||||||
|
--- a/packages/cli-repl/src/cli-repl.ts
|
||||||
|
+++ b/packages/cli-repl/src/cli-repl.ts
|
||||||
|
@@ -159,7 +159,7 @@ export class CliRepl implements MongoshIOProvider {
|
||||||
|
this.config = {
|
||||||
|
userId: id,
|
||||||
|
telemetryAnonymousId: id,
|
||||||
|
- enableTelemetry: true,
|
||||||
|
+ enableTelemetry: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getCryptLibraryPaths = options.getCryptLibraryPaths;
|
6028
pkgs/by-name/mo/mongosh/package-lock.json
generated
6028
pkgs/by-name/mo/mongosh/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,38 +1,59 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
buildNpmPackage,
|
buildNpmPackage,
|
||||||
fetchurl,
|
fetchFromGitHub,
|
||||||
|
fetchpatch,
|
||||||
|
libmongocrypt,
|
||||||
|
krb5,
|
||||||
testers,
|
testers,
|
||||||
mongosh,
|
nix-update-script,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
buildNpmPackage (finalAttrs: {
|
||||||
source = lib.importJSON ./source.json;
|
|
||||||
in
|
|
||||||
buildNpmPackage {
|
|
||||||
pname = "mongosh";
|
pname = "mongosh";
|
||||||
inherit (source) version;
|
version = "2.5.1";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchFromGitHub {
|
||||||
url = "https://registry.npmjs.org/mongosh/-/${source.filename}";
|
owner = "mongodb-js";
|
||||||
hash = source.integrity;
|
repo = "mongosh";
|
||||||
|
|
||||||
|
# Tracking a few commits ahead of 2.5.1 to ensure the package-lock.json patch below applies
|
||||||
|
#tag = "v${finalAttrs.version}";
|
||||||
|
rev = "2163e8b10a77af18e0cedfa164526506c051593e";
|
||||||
|
|
||||||
|
hash = "sha256-DYX8NqAISwzBpdilcv3YVrL72byXMeC4z/nLqd2nf2c=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
patches = [
|
||||||
ln -s ${./package-lock.json} package-lock.json
|
# https://github.com/mongodb-js/mongosh/pull/2452
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/mongodb-js/mongosh/commit/30f66260fce3e1744298d086bd2b54b2d2bfffbb.patch";
|
||||||
|
hash = "sha256-c2QM/toeoagfhvuh4r+/5j7ZyV6DEr9brA9mXpEy1kM=";
|
||||||
|
})
|
||||||
|
|
||||||
|
./disable-telemetry.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-6uXEKAAGXxaODjXIszYml5Af4zSuEzy/QKdMgSzLD84=";
|
||||||
|
npmFlags = [
|
||||||
|
"--omit=optional"
|
||||||
|
"--ignore-scripts"
|
||||||
|
];
|
||||||
|
npmBuildScript = "compile";
|
||||||
|
dontNpmInstall = true;
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
npmWorkspace=packages/mongosh npmInstallHook
|
||||||
|
cp -r packages configs $out/lib/node_modules/mongosh/
|
||||||
|
rm $out/lib/node_modules/mongosh/node_modules/@mongosh/docker-build-scripts # dangling symlink
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
npmDepsHash = source.deps;
|
|
||||||
|
|
||||||
makeCacheWritable = true;
|
|
||||||
dontNpmBuild = true;
|
|
||||||
npmFlags = [ "--omit=optional" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests.version = testers.testVersion {
|
tests.version = testers.testVersion {
|
||||||
package = mongosh;
|
package = finalAttrs.finalPackage;
|
||||||
};
|
};
|
||||||
updateScript = ./update.sh;
|
updateScript = nix-update-script { };
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -42,4 +63,4 @@ buildNpmPackage {
|
||||||
license = lib.licenses.asl20;
|
license = lib.licenses.asl20;
|
||||||
mainProgram = "mongosh";
|
mainProgram = "mongosh";
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"version": "2.4.2",
|
|
||||||
"integrity": "sha512-sNgCITVstYsOkHDH05//wGQ/FJnFfq5gHGoHpIMehX/r2vSm3LEcCW366JlLvRmFj/f4NRGjvFI9c1Ks30W+Zw==",
|
|
||||||
"filename": "mongosh-2.4.2.tgz",
|
|
||||||
"deps": "sha256-aXjK0cW48nih2nI/m2i25zRpmLQ/KHo0KMiNJSvb13g="
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env nix-shell
|
|
||||||
#! nix-shell -i bash -p nodejs libarchive prefetch-npm-deps moreutils jq
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
set -exuo pipefail
|
|
||||||
|
|
||||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
||||||
|
|
||||||
TMPDIR="$(mktemp -d)"
|
|
||||||
trap 'rm -r -- "$TMPDIR"' EXIT
|
|
||||||
|
|
||||||
pushd -- "$TMPDIR"
|
|
||||||
npm pack mongosh --json | jq '.[0] | { version, integrity, filename }' > source.json
|
|
||||||
bsdtar -x -f "$(jq -r .filename source.json)"
|
|
||||||
|
|
||||||
pushd package
|
|
||||||
npm install --omit=optional --package-lock-only
|
|
||||||
popd
|
|
||||||
|
|
||||||
DEPS="$(prefetch-npm-deps package/package-lock.json)"
|
|
||||||
jq ".deps = \"$DEPS\"" source.json | sponge source.json
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
|
||||||
cp -t . -- "$TMPDIR/source.json" "$TMPDIR/package/package-lock.json"
|
|
Loading…
Add table
Add a link
Reference in a new issue