mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 11:00:19 +03:00
Merge pull request #178199 from aaronjheng/mongo-tools
mongodb-tools: use buildGoModule
This commit is contained in:
commit
2ea4d37217
@ -1,58 +1,50 @@
|
||||
{ lib
|
||||
, buildGoPackage
|
||||
, fetchFromGitHub
|
||||
, openssl
|
||||
, pkg-config
|
||||
, libpcap
|
||||
}:
|
||||
{ lib, buildGoModule, fetchFromGitHub, openssl, pkg-config, libpcap }:
|
||||
|
||||
let
|
||||
tools = [
|
||||
"bsondump"
|
||||
"mongoimport"
|
||||
"mongoexport"
|
||||
"mongodump"
|
||||
"mongorestore"
|
||||
"mongostat"
|
||||
"mongofiles"
|
||||
"mongotop"
|
||||
];
|
||||
buildGoModule rec {
|
||||
pname = "mongo-tools";
|
||||
version = "100.5.3";
|
||||
|
||||
in buildGoPackage {
|
||||
pname = "mongo-tools";
|
||||
inherit version;
|
||||
|
||||
goPackagePath = "github.com/mongodb/mongo-tools";
|
||||
subPackages = tools;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
rev = version;
|
||||
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 = ''
|
||||
# move vendored codes so nixpkgs go builder could find it
|
||||
runHook preBuild
|
||||
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" $goPackagePath/${t}/main
|
||||
'') tools}
|
||||
${lib.concatMapStrings (t: ''
|
||||
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" ./${t}/main
|
||||
'') tools}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/mongodb/mongo-tools";
|
||||
description = "Tools for the MongoDB";
|
||||
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user