nixpkgs-suyu/pkgs/tools/misc/mongodb-tools/default.nix
amorsillo b46b0468ca mongodb-tools: 3.0.12 -> 3.5.13 (#29884)
* Upgrade mongodb-tools to 3.5.13 with ssl

* mongodb-tools: fix go references
2017-09-28 11:42:00 +01:00

47 lines
1.2 KiB
Nix

{ stdenv, buildGoPackage, fetchFromGitHub, openssl_1_0_2, pkgconfig, libpcap }:
let
tools = [
"bsondump" "mongodump" "mongoexport" "mongofiles" "mongoimport"
"mongooplog" "mongorestore" "mongostat" "mongotop"
];
in
with stdenv.lib;
buildGoPackage rec {
name = "mongo-tools-${version}";
version = "3.5.13";
rev = "r${version}";
goPackagePath = "github.com/mongodb/mongo-tools";
subPackages = map (t: t + "/main") tools;
src = fetchFromGitHub {
inherit rev;
owner = "mongodb";
repo = "mongo-tools";
sha256 = "00klm4pyx5k39nn4pmfrpnkqxdhbzm7lprgwxszpirzrarh2g164";
};
goDeps = ./deps.nix;
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ openssl_1_0_2 libpcap ];
# Mongodb incorrectly names all of their binaries main
# Let's work around this with our own installer
buildPhase = ''
runHook preBuild
${stdenv.lib.concatMapStrings (t: ''
go build -o "$bin/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
'') tools}
runHook postBuild
'';
meta = {
homepage = https://github.com/mongodb/mongo-tools;
description = "Tools for the MongoDB";
license = licenses.asl20;
};
}