2017-09-28 11:42:00 +01:00
|
|
|
{ stdenv, buildGoPackage, fetchFromGitHub, openssl_1_0_2, pkgconfig, libpcap }:
|
2016-06-03 12:05:48 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
tools = [
|
|
|
|
"bsondump" "mongodump" "mongoexport" "mongofiles" "mongoimport"
|
2018-02-21 21:34:43 +00:00
|
|
|
"mongoreplay" "mongorestore" "mongostat" "mongotop"
|
2016-06-03 12:05:48 +01:00
|
|
|
];
|
|
|
|
in
|
2017-09-28 11:42:00 +01:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2016-06-03 12:05:48 +01:00
|
|
|
buildGoPackage rec {
|
|
|
|
name = "mongo-tools-${version}";
|
2018-02-21 21:34:43 +00:00
|
|
|
version = "3.7.2";
|
2016-06-03 12:05:48 +01:00
|
|
|
rev = "r${version}";
|
|
|
|
|
|
|
|
goPackagePath = "github.com/mongodb/mongo-tools";
|
|
|
|
subPackages = map (t: t + "/main") tools;
|
|
|
|
|
2016-06-06 11:26:56 +01:00
|
|
|
src = fetchFromGitHub {
|
2016-06-03 12:05:48 +01:00
|
|
|
inherit rev;
|
2016-06-06 11:26:56 +01:00
|
|
|
owner = "mongodb";
|
|
|
|
repo = "mongo-tools";
|
2018-02-21 21:34:43 +00:00
|
|
|
sha256 = "1y5hd4qw7422sqkj8vmy4agscvin3ck54r515bjrzn69iw73nhfl";
|
2016-06-03 12:05:48 +01:00
|
|
|
};
|
|
|
|
|
2017-09-28 11:42:00 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ openssl_1_0_2 libpcap ];
|
|
|
|
|
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
|
|
|
|
mv go/src/github.com/mongodb/mongo-tools/vendor/src/* go/src/github.com/mongodb/mongo-tools/vendor/
|
|
|
|
|
2017-09-28 11:42:00 +01:00
|
|
|
runHook preBuild
|
|
|
|
${stdenv.lib.concatMapStrings (t: ''
|
|
|
|
go build -o "$bin/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
|
|
|
|
'') tools}
|
|
|
|
runHook postBuild
|
2016-06-03 12:05:48 +01:00
|
|
|
'';
|
2017-09-28 11:42:00 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = https://github.com/mongodb/mongo-tools;
|
|
|
|
description = "Tools for the MongoDB";
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
2016-06-03 12:05:48 +01:00
|
|
|
}
|