1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5}:
6
7buildNpmPackage (finalAttrs: {
8 pname = "mongosh";
9 version = "2.5.6";
10
11 src = fetchFromGitHub {
12 owner = "mongodb-js";
13 repo = "mongosh";
14 tag = "v${finalAttrs.version}";
15 hash = "sha256-QK2woc6tlnTwYCZ7QEWCn2bRknye2qY8AYAHMVR9i24=";
16 };
17
18 npmDepsHash = "sha256-TfakEOiCtoRz2Fhwz5teOWq0OLb7uZaYiKHLSq/c1OU=";
19
20 patches = [
21 ./disable-telemetry.patch
22 ];
23
24 npmFlags = [
25 "--omit=optional"
26 "--ignore-scripts"
27 ];
28 npmBuildScript = "compile";
29 dontNpmInstall = true;
30 installPhase = ''
31 runHook preInstall
32 npmWorkspace=packages/mongosh npmInstallHook
33 cp -r packages configs $out/lib/node_modules/mongosh/
34 rm $out/lib/node_modules/mongosh/node_modules/@mongosh/docker-build-scripts # dangling symlink
35 runHook postInstall
36 '';
37
38 passthru = {
39 # Version testing is skipped because upstream often forgets to update the version.
40
41 updateScript = ./update.sh;
42 };
43
44 meta = {
45 homepage = "https://www.mongodb.com/try/download/shell";
46 description = "MongoDB Shell";
47 maintainers = with lib.maintainers; [ aaronjheng ];
48 license = lib.licenses.asl20;
49 mainProgram = "mongosh";
50 };
51})