nixpkgs/pkgs/by-name/mo/mongosh/package.nix
2025-07-21 10:12:27 +00:00

52 lines
1.2 KiB
Nix

{
lib,
buildNpmPackage,
fetchFromGitHub,
}:
buildNpmPackage (finalAttrs: {
pname = "mongosh";
version = "2.5.6";
src = fetchFromGitHub {
owner = "mongodb-js";
repo = "mongosh";
tag = "v${finalAttrs.version}";
hash = "sha256-QK2woc6tlnTwYCZ7QEWCn2bRknye2qY8AYAHMVR9i24=";
};
npmDepsHash = "sha256-TfakEOiCtoRz2Fhwz5teOWq0OLb7uZaYiKHLSq/c1OU=";
patches = [
./disable-telemetry.patch
];
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";
description = "MongoDB Shell";
maintainers = with lib.maintainers; [ aaronjheng ];
license = lib.licenses.asl20;
mainProgram = "mongosh";
};
})