about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix')
-rw-r--r--nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix30
1 files changed, 24 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix b/nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix
index 8ffdbcd63c4c..f57ff7461989 100644
--- a/nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix
+++ b/nixpkgs/pkgs/servers/nosql/mongodb/mongodb.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchurl, scons, boost, gperftools, pcre-cpp, snappy, zlib, libyamlcpp
-, sasl, openssl, libpcap, python27, curl, Security, CoreFoundation, cctools }:
+{ stdenv, fetchurl, sconsPackages, boost, gperftools, pcre-cpp, snappy, zlib, libyamlcpp
+, sasl, openssl, libpcap, python27, python38, curl, Security, CoreFoundation, cctools }:
 
 # Note:
 # The command line tools are written in Go as part of a different package (mongodb-tools)
@@ -11,6 +11,17 @@ with stdenv.lib;
 }@args:
 
 let
+  variants = if versionAtLeast version "4.2"
+    then { python = python38.withPackages (ps: with ps; [ pyyaml cheetah3 psutil setuptools ]);
+            scons = sconsPackages.scons_latest;
+            mozjsVersion = "60";
+            mozjsReplace = "defined(HAVE___SINCOS)";
+          }
+    else { python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
+            scons = sconsPackages.scons_3_1_2;
+            mozjsVersion = "45";
+            mozjsReplace = "defined(HAVE_SINCOS)";
+          };
   python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
   system-libraries = [
     "boost"
@@ -27,14 +38,14 @@ let
 
 in stdenv.mkDerivation rec {
   inherit version;
-  name = "mongodb-${version}";
+  pname = "mongodb";
 
   src = fetchurl {
     url = "https://fastdl.mongodb.org/src/mongodb-src-r${version}.tar.gz";
     inherit sha256;
   };
 
-  nativeBuildInputs = [ scons.py2 ];
+  nativeBuildInputs = [ variants.scons ];
   buildInputs = [
     boost
     curl
@@ -43,7 +54,7 @@ in stdenv.mkDerivation rec {
     libyamlcpp
     openssl
     pcre-cpp
-    python
+    variants.python
     sasl
     snappy
     zlib
@@ -59,7 +70,7 @@ in stdenv.mkDerivation rec {
     substituteInPlace SConstruct \
         --replace "env = Environment(" "env = Environment(ENV = os.environ,"
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace src/third_party/mozjs-45/extract/js/src/jsmath.cpp --replace 'defined(HAVE_SINCOS)' 0
+    substituteInPlace src/third_party/mozjs-${variants.mozjsVersion}/extract/js/src/jsmath.cpp --replace '${variants.mozjsReplace}' 0
 
     substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder
     substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder
@@ -102,6 +113,13 @@ in stdenv.mkDerivation rec {
     rm -f "$out/bin/install_compass" || true
   '';
 
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+    "$out/bin/mongo" --version
+    runHook postInstallCheck
+  '';
+
   prefixKey = "--prefix=";
 
   enableParallelBuilding = true;