2017-09-28 12:42:00 +02:00
|
|
|
{ stdenv, buildGoPackage, fetchFromGitHub, openssl_1_0_2, pkgconfig, libpcap }:
|
2016-06-03 13:05:48 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
tools = [
|
|
|
|
"bsondump" "mongodump" "mongoexport" "mongofiles" "mongoimport"
|
|
|
|
"mongooplog" "mongorestore" "mongostat" "mongotop"
|
|
|
|
];
|
|
|
|
in
|
2017-09-28 12:42:00 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2016-06-03 13:05:48 +02:00
|
|
|
buildGoPackage rec {
|
|
|
|
name = "mongo-tools-${version}";
|
2017-09-28 12:42:00 +02:00
|
|
|
version = "3.5.13";
|
2016-06-03 13:05:48 +02:00
|
|
|
rev = "r${version}";
|
|
|
|
|
|
|
|
goPackagePath = "github.com/mongodb/mongo-tools";
|
|
|
|
subPackages = map (t: t + "/main") tools;
|
|
|
|
|
2016-06-06 12:26:56 +02:00
|
|
|
src = fetchFromGitHub {
|
2016-06-03 13:05:48 +02:00
|
|
|
inherit rev;
|
2016-06-06 12:26:56 +02:00
|
|
|
owner = "mongodb";
|
|
|
|
repo = "mongo-tools";
|
2017-09-28 12:42:00 +02:00
|
|
|
sha256 = "00klm4pyx5k39nn4pmfrpnkqxdhbzm7lprgwxszpirzrarh2g164";
|
2016-06-03 13:05:48 +02:00
|
|
|
};
|
|
|
|
|
2016-09-10 12:04:13 +02:00
|
|
|
goDeps = ./deps.nix;
|
2016-06-03 13:05:48 +02:00
|
|
|
|
2017-09-28 12:42:00 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ openssl_1_0_2 libpcap ];
|
|
|
|
|
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 = ''
|
|
|
|
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 13:05:48 +02:00
|
|
|
'';
|
2017-09-28 12:42:00 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = https://github.com/mongodb/mongo-tools;
|
|
|
|
description = "Tools for the MongoDB";
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
2016-06-03 13:05:48 +02:00
|
|
|
}
|