mmdbctl: init at 1.4.6 (#352043)

This commit is contained in:
Aleksana 2024-10-29 19:00:30 +08:00 committed by GitHub
commit 7b5bc03968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,55 @@
{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
stdenv,
runCommand,
mmdbctl,
dbip-country-lite,
}:
buildGoModule rec {
pname = "mmdbctl";
version = "1.4.6";
src = fetchFromGitHub {
owner = "ipinfo";
repo = "mmdbctl";
rev = "refs/tags/mmdbctl-${version}";
hash = "sha256-6hJ9V8fHs84Lq48l3mB9nZka4rLneyxD4HMhWQYZ0cI=";
};
vendorHash = "sha256-5vd39j/gpRRkUccctKGU8+QL0vANm2FMyw6jTtoqJmw=";
ldflags = [
"-s"
"-w"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd mmdbctl \
--bash <($out/bin/mmdbctl completion bash) \
--fish <($out/bin/mmdbctl completion fish) \
--zsh <($out/bin/mmdbctl completion zsh)
'';
passthru.tests = {
simple = runCommand "${pname}-test" { } ''
${lib.getExe mmdbctl} verify ${dbip-country-lite}/share/dbip/dbip-country-lite.mmdb | grep valid
${lib.getExe mmdbctl} metadata ${dbip-country-lite}/share/dbip/dbip-country-lite.mmdb | grep DBIP-Country-Lite
touch $out
'';
};
meta = {
description = "MMDB file management CLI supporting various operations on MMDB database files";
homepage = "https://github.com/ipinfo/mmdbctl";
changelog = "https://github.com/ipinfo/mmdbctl/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ moraxyc ];
mainProgram = "mmdbctl";
};
}