@@ -1,49 +1,59 @@
1−{ stdenv, fetchurl, fetchpatch, scons, boost, gperftools, pcre-cpp, snappy, zlib,
2− libyamlcpp, sasl, openssl, libpcap, wiredtiger, Security, python27, libtool, curl
3−}:
1+{ stdenv, fetchurl, fetchpatch, scons, boost, gperftools, pcre-cpp, snappy, zlib
2+, libyamlcpp, sasl, openssl, libpcap, wiredtiger, Security, python27, libtool
3+, curl }:
44
55# Note:
66# The command line tools are written in Go as part of a different package (mongodb-tools)
77
88with stdenv.lib;
99
10−let version = "4.0.4";
11− python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
12− system-libraries = [
13− "pcre"
14− #"asio" -- XXX use package?
15− #"wiredtiger"
16− "boost"
17− "snappy"
18− "zlib"
19− #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
20− #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
21− "yaml"
22− ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
23− inherit (stdenv.lib) systems subtractLists;
24−
25−in stdenv.mkDerivation {
26− pname = "mongodb";
10+{ version, sha256, patches ? [ ] }@args:
11+
12+let
13+ python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
14+ system-libraries = [
15+ "pcre"
16+ #"asio" -- XXX use package?
17+ #"wiredtiger"
18+ "boost"
19+ "snappy"
20+ "zlib"
21+ #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
22+ #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
23+ "yaml"
24+ ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
25+ inherit (stdenv.lib) systems subtractLists;
26+
27+in stdenv.mkDerivation rec {
2728 inherit version;
29+ name = "mongodb-${version}";
2830
2931 src = fetchurl {
3032 url = "https://fastdl.mongodb.org/src/mongodb-src-r${version}.tar.gz";
31− sha256 = "1qycwr9f99b5cy4nf54yv2y724xis3lwd2h6iv2pfp36qnhsvfh2";
33+ inherit sha256;
3234 };
3335
3436 nativeBuildInputs = [ scons ];
3537 buildInputs = [
36− sasl boost gperftools pcre-cpp snappy
37− zlib libyamlcpp sasl openssl.dev openssl.out libpcap python curl
38+ sasl
39+ boost
40+ gperftools
41+ pcre-cpp
42+ snappy
43+ zlib
44+ libyamlcpp
45+ sasl
46+ openssl.dev
47+ openssl.out
48+ libpcap
49+ python
50+ curl
3851 ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security libtool ];
3952
40− patches =
41− [
42− # MongoDB keeps track of its build parameters, which tricks nix into
43− # keeping dependencies to build inputs in the final output.
44− # We remove the build flags from buildInfo data.
45− ./forget-build-dependencies.patch
46− ];
53+ # MongoDB keeps track of its build parameters, which tricks nix into
54+ # keeping dependencies to build inputs in the final output.
55+ # We remove the build flags from buildInfo data.
56+ inherit patches;
4757
4858 postPatch = ''
4959 # fix environment variable reading
@@ -63,7 +73,8 @@ in stdenv.mkDerivation {
6373 --replace 'engine("wiredTiger")' 'engine("mmapv1")'
6474 '';
6575
66− NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument";
76+ NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang
77+ "-Wno-unused-command-line-argument";
6778
6879 sconsFlags = [
6980 "--release"
@@ -84,11 +95,11 @@ in stdenv.mkDerivation {
8495 '';
8596
8697 preInstall = ''
87− mkdir -p $out/lib
98+ mkdir -p "$out/lib"
8899 '';
89100
90101 postInstall = ''
91− rm $out/bin/install_compass
102+ rm -f "$out/bin/install_compass" || true
92103 '';
93104
94105 prefixKey = "--prefix=";
@@ -99,9 +110,9 @@ in stdenv.mkDerivation {
99110
100111 meta = {
101112 description = "A scalable, high-performance, open source NoSQL database";
102− homepage = http://www.mongodb.org;
113+ homepage = "http://www.mongodb.org";
103114 license = licenses.sspl;
104− broken = stdenv.hostPlatform.isAarch64; #g++ has internal compiler errors
115+ broken = stdenv.hostPlatform.isAarch64; # g++ has internal compiler errors
105116
106117 maintainers = with maintainers; [ bluescreen303 offline cstrahan ];
107118 platforms = subtractLists systems.doubles.i686 systems.doubles.unix;