2022-06-26 10:26:21 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, openssl, pkg-config, libpcap }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "mongo-tools";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "100.9.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mongodb";
|
|
|
|
repo = "mongo-tools";
|
2022-06-26 10:26:21 +00:00
|
|
|
rev = version;
|
2024-01-02 11:29:13 +00:00
|
|
|
sha256 = "sha256-l3A7ykkQCkT34EdgpcSJpFsZq1gE9GII9gzaXJaUwEk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
vendorHash = null;
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ openssl libpcap ];
|
|
|
|
|
|
|
|
# Mongodb incorrectly names all of their binaries main
|
|
|
|
# Let's work around this with our own installer
|
2022-06-26 10:26:21 +00:00
|
|
|
buildPhase =
|
|
|
|
let
|
|
|
|
tools = [
|
|
|
|
"bsondump"
|
|
|
|
"mongodump"
|
|
|
|
"mongoexport"
|
|
|
|
"mongofiles"
|
|
|
|
"mongoimport"
|
|
|
|
"mongorestore"
|
|
|
|
"mongostat"
|
|
|
|
"mongotop"
|
|
|
|
]; in
|
|
|
|
''
|
|
|
|
# move vendored codes so nixpkgs go builder could find it
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
${lib.concatMapStrings (t: ''
|
|
|
|
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" ./${t}/main
|
|
|
|
'') tools}
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/mongodb/mongo-tools";
|
|
|
|
description = "Tools for the MongoDB";
|
|
|
|
license = lib.licenses.asl20;
|
2022-06-26 10:26:21 +00:00
|
|
|
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|