Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 55 lines 1.4 kB view raw
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 installShellFiles, 6 stdenv, 7 runCommand, 8 mmdbctl, 9 dbip-country-lite, 10}: 11 12buildGoModule rec { 13 pname = "mmdbctl"; 14 version = "1.4.7"; 15 16 src = fetchFromGitHub { 17 owner = "ipinfo"; 18 repo = "mmdbctl"; 19 tag = "mmdbctl-${version}"; 20 hash = "sha256-drYtuL4TzutzitLVKyUotxgyDjL7AMNnt0vVtfQhu4A="; 21 }; 22 23 vendorHash = "sha256-4T3HEzRerC4KrGQnMNSW3OVzChUIf4yJ7qS9v8mWIX4="; 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.mmdb} | grep valid 42 ${lib.getExe mmdbctl} metadata ${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}