Merge pull request #178199 from aaronjheng/mongo-tools
mongodb-tools: use buildGoModule
This commit is contained in:
commit
2ea4d37217
1 changed files with 27 additions and 35 deletions
|
@ -1,58 +1,50 @@
|
||||||
{ lib
|
{ lib, buildGoModule, fetchFromGitHub, openssl, pkg-config, libpcap }:
|
||||||
, buildGoPackage
|
|
||||||
, fetchFromGitHub
|
|
||||||
, openssl
|
|
||||||
, pkg-config
|
|
||||||
, libpcap
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
buildGoModule rec {
|
||||||
tools = [
|
pname = "mongo-tools";
|
||||||
"bsondump"
|
|
||||||
"mongoimport"
|
|
||||||
"mongoexport"
|
|
||||||
"mongodump"
|
|
||||||
"mongorestore"
|
|
||||||
"mongostat"
|
|
||||||
"mongofiles"
|
|
||||||
"mongotop"
|
|
||||||
];
|
|
||||||
version = "100.5.3";
|
version = "100.5.3";
|
||||||
|
|
||||||
in buildGoPackage {
|
|
||||||
pname = "mongo-tools";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
goPackagePath = "github.com/mongodb/mongo-tools";
|
|
||||||
subPackages = tools;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
rev = version;
|
|
||||||
owner = "mongodb";
|
owner = "mongodb";
|
||||||
repo = "mongo-tools";
|
repo = "mongo-tools";
|
||||||
|
rev = version;
|
||||||
sha256 = "sha256-8RkpBCFVxKVsu4h2z+rhlwvYfbSDHZUg8erO4+2GRbw=";
|
sha256 = "sha256-8RkpBCFVxKVsu4h2z+rhlwvYfbSDHZUg8erO4+2GRbw=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vendorSha256 = null;
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config ];
|
nativeBuildInputs = [ pkg-config ];
|
||||||
buildInputs = [ openssl libpcap ];
|
buildInputs = [ openssl libpcap ];
|
||||||
|
|
||||||
# Mongodb incorrectly names all of their binaries main
|
# Mongodb incorrectly names all of their binaries main
|
||||||
# Let's work around this with our own installer
|
# Let's work around this with our own installer
|
||||||
buildPhase = ''
|
buildPhase =
|
||||||
# move vendored codes so nixpkgs go builder could find it
|
let
|
||||||
runHook preBuild
|
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: ''
|
${lib.concatMapStrings (t: ''
|
||||||
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" $goPackagePath/${t}/main
|
go build -o "$out/bin/${t}" -tags ssl -ldflags "-s -w" ./${t}/main
|
||||||
'') tools}
|
'') tools}
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://github.com/mongodb/mongo-tools";
|
homepage = "https://github.com/mongodb/mongo-tools";
|
||||||
description = "Tools for the MongoDB";
|
description = "Tools for the MongoDB";
|
||||||
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
|
||||||
license = lib.licenses.asl20;
|
license = lib.licenses.asl20;
|
||||||
|
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue