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