2019-09-05 21:27:09 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
2020-01-11 10:12:04 +00:00
|
|
|
, openssl
|
2019-09-05 21:27:09 +00:00
|
|
|
, pkgconfig
|
|
|
|
, libpcap
|
|
|
|
}:
|
2016-06-03 11:05:48 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
tools = [
|
2019-09-05 21:27:09 +00:00
|
|
|
"bsondump"
|
|
|
|
"mongoimport"
|
|
|
|
"mongoexport"
|
|
|
|
"mongodump"
|
|
|
|
"mongorestore"
|
|
|
|
"mongostat"
|
|
|
|
"mongofiles"
|
|
|
|
"mongotop"
|
|
|
|
"mongoreplay"
|
2016-06-03 11:05:48 +00:00
|
|
|
];
|
2019-09-05 21:27:09 +00:00
|
|
|
version = "4.2.0";
|
2017-09-28 10:42:00 +00:00
|
|
|
|
2019-09-05 21:27:09 +00:00
|
|
|
in buildGoPackage {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mongo-tools";
|
2019-09-05 21:27:09 +00:00
|
|
|
inherit version;
|
2016-06-03 11:05:48 +00:00
|
|
|
|
|
|
|
goPackagePath = "github.com/mongodb/mongo-tools";
|
2019-09-05 21:27:09 +00:00
|
|
|
subPackages = tools;
|
2016-06-03 11:05:48 +00:00
|
|
|
|
2016-06-06 10:26:56 +00:00
|
|
|
src = fetchFromGitHub {
|
2019-09-05 21:27:09 +00:00
|
|
|
rev = "r${version}";
|
2016-06-06 10:26:56 +00:00
|
|
|
owner = "mongodb";
|
|
|
|
repo = "mongo-tools";
|
2019-09-05 21:27:09 +00:00
|
|
|
sha256 = "0mjwvx0cxvb6zam6jyr3753xjnwcygxcjzqhhlsq0b3xnwws9yh7";
|
2016-06-03 11:05:48 +00:00
|
|
|
};
|
|
|
|
|
2017-09-28 10:42:00 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2020-01-11 10:12:04 +00:00
|
|
|
buildInputs = [ openssl libpcap ];
|
2017-09-28 10:42:00 +00:00
|
|
|
|
2016-06-03 11:05:48 +00:00
|
|
|
# Mongodb incorrectly names all of their binaries main
|
|
|
|
# Let's work around this with our own installer
|
2017-09-28 10:42:00 +00:00
|
|
|
buildPhase = ''
|
2018-02-21 21:34:43 +00:00
|
|
|
# move vendored codes so nixpkgs go builder could find it
|
2017-09-28 10:42:00 +00:00
|
|
|
runHook preBuild
|
2019-09-05 21:27:09 +00:00
|
|
|
|
2017-09-28 10:42:00 +00:00
|
|
|
${stdenv.lib.concatMapStrings (t: ''
|
2020-04-28 01:50:57 +00:00
|
|
|
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
|
2017-09-28 10:42:00 +00:00
|
|
|
'') tools}
|
2019-09-05 21:27:09 +00:00
|
|
|
|
2017-09-28 10:42:00 +00:00
|
|
|
runHook postBuild
|
2016-06-03 11:05:48 +00:00
|
|
|
'';
|
2017-09-28 10:42:00 +00:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/mongodb/mongo-tools";
|
2017-09-28 10:42:00 +00:00
|
|
|
description = "Tools for the MongoDB";
|
2019-09-05 21:27:09 +00:00
|
|
|
license = lib.licenses.asl20;
|
2017-09-28 10:42:00 +00:00
|
|
|
};
|
2016-06-03 11:05:48 +00:00
|
|
|
}
|