blob: 28afffd84eb8d73f7f49e361e62e37befdad5f16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
lib,
buildNpmPackage,
fetchFromGitHub,
}:
buildNpmPackage (finalAttrs: {
pname = "mongosh";
version = "2.10.0";
src = fetchFromGitHub {
owner = "mongodb-js";
repo = "mongosh";
tag = "v${finalAttrs.version}";
hash = "sha256-SJkDBo/rtbh3rh5oPjjS5zXG6eye+PCY3pI1FN281Ps=";
};
npmDepsHash = "sha256-xmjlvncUVVp7Y+qCBpJNiuvc5n2IBKqXk715EOmWo/U=";
postPatch = ''
# Disable telemetry by default; users can still opt in via enableTelemetry().
substituteInPlace packages/cli-repl/src/cli-repl.ts \
--replace-fail "enableTelemetry: true" "enableTelemetry: false"
'';
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
'';
passthru = {
# Version testing is skipped because upstream often forgets to update the version.
updateScript = ./update.sh;
};
meta = {
homepage = "https://www.mongodb.com/try/download/shell";
changelog = "https://github.com/mongodb-js/mongosh/releases/tag/v${finalAttrs.version}";
description = "MongoDB Shell";
maintainers = with lib.maintainers; [ aaronjheng ];
license = lib.licenses.asl20;
mainProgram = "mongosh";
};
})
|