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