2021-01-25 09:26:54 +01:00
|
|
|
{ lib
|
2019-09-05 23:27:09 +02:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
2020-01-11 11:12:04 +01:00
|
|
|
, openssl
|
2021-01-17 04:51:22 +01:00
|
|
|
, pkg-config
|
2019-09-05 23:27:09 +02:00
|
|
|
, libpcap
|
|
|
|
}:
|
2016-06-03 13:05:48 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
tools = [
|
2019-09-05 23:27:09 +02:00
|
|
|
"bsondump"
|
|
|
|
"mongoimport"
|
|
|
|
"mongoexport"
|
|
|
|
"mongodump"
|
|
|
|
"mongorestore"
|
|
|
|
"mongostat"
|
|
|
|
"mongofiles"
|
|
|
|
"mongotop"
|
2016-06-03 13:05:48 +02:00
|
|
|
];
|
2021-11-15 22:58:44 +01:00
|
|
|
version = "100.5.1";
|
2017-09-28 12:42:00 +02:00
|
|
|
|
2019-09-05 23:27:09 +02:00
|
|
|
in buildGoPackage {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "mongo-tools";
|
2019-09-05 23:27:09 +02:00
|
|
|
inherit version;
|
2016-06-03 13:05:48 +02:00
|
|
|
|
|
|
|
goPackagePath = "github.com/mongodb/mongo-tools";
|
2019-09-05 23:27:09 +02:00
|
|
|
subPackages = tools;
|
2016-06-03 13:05:48 +02:00
|
|
|
|
2016-06-06 12:26:56 +02:00
|
|
|
src = fetchFromGitHub {
|
2021-11-15 22:58:44 +01:00
|
|
|
rev = version;
|
2016-06-06 12:26:56 +02:00
|
|
|
owner = "mongodb";
|
|
|
|
repo = "mongo-tools";
|
2021-11-15 22:58:44 +01:00
|
|
|
sha256 = "sha256-Qxtb7DJOgrCUvoGVgmKh4qKS4duvEWwW9BLkdt5M5ZY=";
|
2016-06-03 13:05:48 +02:00
|
|
|
};
|
|
|
|
|
2021-01-17 04:51:22 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-01-11 11:12:04 +01:00
|
|
|
buildInputs = [ openssl libpcap ];
|
2017-09-28 12:42:00 +02:00
|
|
|
|
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 = ''
|
2018-02-21 22:34:43 +01:00
|
|
|
# move vendored codes so nixpkgs go builder could find it
|
2017-09-28 12:42:00 +02:00
|
|
|
runHook preBuild
|
2019-09-05 23:27:09 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
${lib.concatMapStrings (t: ''
|
2020-04-28 03:50:57 +02:00
|
|
|
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
|
2017-09-28 12:42:00 +02:00
|
|
|
'') tools}
|
2019-09-05 23:27:09 +02:00
|
|
|
|
2017-09-28 12:42:00 +02:00
|
|
|
runHook postBuild
|
2016-06-03 13:05:48 +02:00
|
|
|
'';
|
2017-09-28 12:42:00 +02:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/mongodb/mongo-tools";
|
2017-09-28 12:42:00 +02:00
|
|
|
description = "Tools for the MongoDB";
|
2021-11-15 23:07:24 +01:00
|
|
|
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
2019-09-05 23:27:09 +02:00
|
|
|
license = lib.licenses.asl20;
|
2017-09-28 12:42:00 +02:00
|
|
|
};
|
2016-06-03 13:05:48 +02:00
|
|
|
}
|