@@ -1,58 +1,63 @@
1−{ stdenv, fetchurl, fetchpatch, scons, boost, gperftools, pcre-cpp, snappy
2−, zlib, libyamlcpp, sasl, openssl, libpcap, Security
3−}:
1+{ stdenv, fetchurl, scons, boost, gperftools, pcre-cpp, snappy, zlib, libyamlcpp
2+, sasl, openssl, libpcap, python27, curl, Security, CoreFoundation, cctools }:
43
54# Note:
65# The command line tools are written in Go as part of a different package (mongodb-tools)
76
87with stdenv.lib;
98
10−let version = "3.4.10";
11− system-libraries = [
12− "pcre"
13− #"asio" -- XXX use package?
14− #"wiredtiger"
15− "boost"
16− "snappy"
17− "zlib"
18− #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
19− #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
20− "yaml"
21− ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
22−
23−in stdenv.mkDerivation {
24− pname = "mongodb";
9+{ version, sha256, patches ? [] }@args:
10+
11+let
12+ python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
13+ system-libraries = [
14+ "boost"
15+ "pcre"
16+ "snappy"
17+ "yaml"
18+ "zlib"
19+ #"asio" -- XXX use package?
20+ #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
21+ #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
22+ #"wiredtiger"
23+ ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
24+ inherit (stdenv.lib) systems subtractLists;
25+
26+in stdenv.mkDerivation rec {
2527 inherit version;
28+ name = "mongodb-${version}";
2629
2730 src = fetchurl {
2831 url = "https://fastdl.mongodb.org/src/mongodb-src-r${version}.tar.gz";
29− sha256 = "1wz2mhl9z0b1bdkg6m8v8mvw9k60mdv5ybq554xn3yjj9z500f24";
32+ inherit sha256;
3033 };
3134
3235 nativeBuildInputs = [ scons ];
3336 buildInputs = [
34− sasl boost gperftools pcre-cpp snappy
35− zlib libyamlcpp sasl openssl.dev openssl.out libpcap
36− ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
37−
38− patches =
39− [
40− # MongoDB keeps track of its build parameters, which tricks nix into
41− # keeping dependencies to build inputs in the final output.
42− # We remove the build flags from buildInfo data.
43− ./forget-build-dependencies.patch
44− (fetchpatch {
45− url = https://projects.archlinux.org/svntogit/community.git/plain/trunk/boost160.patch?h=packages/mongodb;
46− name = "boost160.patch";
47− sha256 = "0bvsf3499zj55pzamwjmsssr6x63w434944w76273fr5rxwzcmh8";
48− })
49− ];
37+ boost
38+ curl
39+ gperftools
40+ libpcap
41+ libyamlcpp
42+ openssl
43+ pcre-cpp
44+ python
45+ sasl
46+ snappy
47+ zlib
48+ ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security CoreFoundation cctools ];
49+
50+ # MongoDB keeps track of its build parameters, which tricks nix into
51+ # keeping dependencies to build inputs in the final output.
52+ # We remove the build flags from buildInfo data.
53+ inherit patches;
5054
5155 postPatch = ''
5256 # fix environment variable reading
5357 substituteInPlace SConstruct \
5458 --replace "env = Environment(" "env = Environment(ENV = os.environ,"
5559 '' + stdenv.lib.optionalString stdenv.isDarwin ''
60+ substituteInPlace src/third_party/mozjs-45/extract/js/src/jsmath.cpp --replace 'defined(HAVE_SINCOS)' 0
5661
5762 substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder
5863 substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder
@@ -66,13 +71,14 @@ in stdenv.mkDerivation {
6671 --replace 'engine("wiredTiger")' 'engine("mmapv1")'
6772 '';
6873
69− NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument";
74+ NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang
75+ "-Wno-unused-command-line-argument";
7076
7177 sconsFlags = [
7278 "--release"
7379 "--ssl"
7480 #"--rocksdb" # Don't have this packaged yet
75− "--wiredtiger=${if stdenv.is64bit then "on" else "off"}"
81+ "--wiredtiger=on"
7682 "--js-engine=mozjs"
7783 "--use-sasl-client"
7884 "--disable-warnings-as-errors"
@@ -87,8 +93,13 @@ in stdenv.mkDerivation {
8793 '';
8894
8995 preInstall = ''
90− mkdir -p $out/lib
96+ mkdir -p "$out/lib"
9197 '';
98+
99+ postInstall = ''
100+ rm -f "$out/bin/install_compass" || true
101+ '';
102+
92103 prefixKey = "--prefix=";
93104
94105 enableParallelBuilding = true;
@@ -97,10 +108,10 @@ in stdenv.mkDerivation {
97108
98109 meta = {
99110 description = "A scalable, high-performance, open source NoSQL database";
100− homepage = http://www.mongodb.org;
101− license = licenses.agpl3;
111+ homepage = "http://www.mongodb.org";
112+ license = licenses.sspl;
102113
103114 maintainers = with maintainers; [ bluescreen303 offline cstrahan ];
104− platforms = platforms.unix;
115+ platforms = subtractLists systems.doubles.i686 systems.doubles.unix;
105116 };
106117}