Skip to content

Commit 7b5bc03

Browse files
authored
mmdbctl: init at 1.4.6 (#352043)
2 parents 91d052e + 2dbd1f9 commit 7b5bc03

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
lib,
3+
buildGoModule,
4+
fetchFromGitHub,
5+
installShellFiles,
6+
stdenv,
7+
runCommand,
8+
mmdbctl,
9+
dbip-country-lite,
10+
}:
11+
12+
buildGoModule rec {
13+
pname = "mmdbctl";
14+
version = "1.4.6";
15+
16+
src = fetchFromGitHub {
17+
owner = "ipinfo";
18+
repo = "mmdbctl";
19+
rev = "refs/tags/mmdbctl-${version}";
20+
hash = "sha256-6hJ9V8fHs84Lq48l3mB9nZka4rLneyxD4HMhWQYZ0cI=";
21+
};
22+
23+
vendorHash = "sha256-5vd39j/gpRRkUccctKGU8+QL0vANm2FMyw6jTtoqJmw=";
24+
25+
ldflags = [
26+
"-s"
27+
"-w"
28+
];
29+
30+
nativeBuildInputs = [ installShellFiles ];
31+
32+
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33+
installShellCompletion --cmd mmdbctl \
34+
--bash <($out/bin/mmdbctl completion bash) \
35+
--fish <($out/bin/mmdbctl completion fish) \
36+
--zsh <($out/bin/mmdbctl completion zsh)
37+
'';
38+
39+
passthru.tests = {
40+
simple = runCommand "${pname}-test" { } ''
41+
${lib.getExe mmdbctl} verify ${dbip-country-lite}/share/dbip/dbip-country-lite.mmdb | grep valid
42+
${lib.getExe mmdbctl} metadata ${dbip-country-lite}/share/dbip/dbip-country-lite.mmdb | grep DBIP-Country-Lite
43+
touch $out
44+
'';
45+
};
46+
47+
meta = {
48+
description = "MMDB file management CLI supporting various operations on MMDB database files";
49+
homepage = "https://github.com/ipinfo/mmdbctl";
50+
changelog = "https://github.com/ipinfo/mmdbctl/blob/${src.rev}/CHANGELOG.md";
51+
license = lib.licenses.asl20;
52+
maintainers = with lib.maintainers; [ moraxyc ];
53+
mainProgram = "mmdbctl";
54+
};
55+
}

0 commit comments

Comments
 (0)