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"
|
|
|
|
"mongooplog" "mongorestore" "mongostat" "mongotop"
|
|
|
|
];
|
|
|
|
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}";
|
2017-09-28 11:42:00 +01:00
|
|
|
version = "3.5.13";
|
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";
|
2017-09-28 11:42:00 +01:00
|
|
|
sha256 = "00klm4pyx5k39nn4pmfrpnkqxdhbzm7lprgwxszpirzrarh2g164";
|
2016-06-03 12:05:48 +01:00
|
|
|
};
|
|
|
|
|
2016-09-10 11:04:13 +01:00
|
|
|
goDeps = ./deps.nix;
|
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 = ''
|
|
|
|
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
|
|
|
}
|