about summary refs log tree commit diff
path: root/pkgs/development/tools/mongosh/default.nix
blob: 0bc4aa24a1a8f615480f36b7ef5e735e08f005e8 (plain) (blame)
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
{ lib
, buildNpmPackage
, fetchurl
, testers
, mongosh
}:

let
  source = builtins.fromJSON (builtins.readFile ./source.json);
in
buildNpmPackage {
  pname = "mongosh";
  inherit (source) version;

  src = fetchurl {
    url = "https://registry.npmjs.org/mongosh/-/${source.filename}";
    hash = source.integrity;
  };

  postPatch = ''
    ln -s ${./package-lock.json} package-lock.json
  '';

  npmDepsHash = source.deps;

  makeCacheWritable = true;
  dontNpmBuild = true;
  npmFlags = [ "--omit=optional" ];

  passthru = {
    tests.version = testers.testVersion {
      package = mongosh;
    };
    updateScript = ./update.sh;
  };

  meta = with lib; {
    homepage = "https://www.mongodb.com/try/download/shell";
    description = "The MongoDB Shell";
    maintainers = with maintainers; [ aaronjheng ];
    license = licenses.asl20;
    mainProgram = "mongosh";
  };
}