blob: dd95806f8c2fbdf07745bb7ae4ee8314bf19dc05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{
lib,
buildGoModule,
fetchFromGitHub,
openssl,
pkg-config,
libpcap,
nix-update-script,
krb5,
}:
buildGoModule (finalAttrs: {
pname = "mongo-tools";
version = "100.18.0";
src = fetchFromGitHub {
owner = "mongodb";
repo = "mongo-tools";
tag = finalAttrs.version;
hash = "sha256-cNz5qQhTcW7hBdvXQRnnnvIz4UpC0ZmFVxMfxUSJ2y8=";
};
vendorHash = null;
nativeBuildInputs = [ pkg-config ];
buildInputs = [
openssl
libpcap
krb5
];
# 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 "gssapi ssl" -ldflags "-s -w" ./${t}/main
'') tools}
runHook postBuild
'';
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://github.com/mongodb/mongo-tools";
description = "Tools for the MongoDB";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
iamanaws
];
};
})
|