889482aab3
GitOrigin-RevId: f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5
50 lines
1.2 KiB
Nix
50 lines
1.2 KiB
Nix
{ lib, buildGoModule, fetchFromGitHub, openssl, pkg-config, libpcap }:
|
|
|
|
buildGoModule rec {
|
|
pname = "mongo-tools";
|
|
version = "100.5.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "mongodb";
|
|
repo = "mongo-tools";
|
|
rev = version;
|
|
sha256 = "sha256-8RkpBCFVxKVsu4h2z+rhlwvYfbSDHZUg8erO4+2GRbw=";
|
|
};
|
|
|
|
vendorSha256 = null;
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = [ openssl libpcap ];
|
|
|
|
# Mongodb incorrectly names all of their binaries main
|
|
# Let's work around this with our own installer
|
|
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
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "https://github.com/mongodb/mongo-tools";
|
|
description = "Tools for the MongoDB";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
|
};
|
|
}
|