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: ''
|
|
|
|
go build -o "$bin/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
|
|
|
|
'') 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 = {
|
|
|
|
homepage = https://github.com/mongodb/mongo-tools;
|
|
|
|
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
|
|
|
}
|