1{ 2 lib, 3 stdenv, 4 buildGoModule, 5 fetchFromGitHub, 6 installShellFiles, 7 buildPackages, 8 nix-update-script, 9}: 10buildGoModule rec { 11 pname = "mdtsql"; 12 version = "0.1.0"; 13 14 src = fetchFromGitHub { 15 owner = "noborus"; 16 repo = "mdtsql"; 17 tag = "v${version}"; 18 hash = "sha256-D9suWLrVQOztz0rRjEo+pjxQlGWOOsk3EUbkN9yuriY="; 19 }; 20 21 vendorHash = "sha256-psXnLMhrApyBjDY/S4WwIM1GLczyn4dUmX2fWSTq7mQ="; 22 23 nativeBuildInputs = [ 24 installShellFiles 25 ]; 26 27 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( 28 let 29 emulator = stdenv.hostPlatform.emulator buildPackages; 30 in 31 '' 32 installShellCompletion --cmd mdtsql \ 33 --bash <(${emulator} $out/bin/mdtsql completion bash) \ 34 --fish <(${emulator} $out/bin/mdtsql completion fish) \ 35 --zsh <(${emulator} $out/bin/mdtsql completion zsh) 36 '' 37 ); 38 39 passthru.updateScript = nix-update-script { }; 40 41 meta = { 42 description = "Execute SQL to markdown table and convert to other format"; 43 homepage = "https://github.com/noborus/mdtsql"; 44 changelog = "https://github.com/noborus/mdtsql/releases/tag/v${version}"; 45 license = lib.licenses.mit; 46 maintainers = with lib.maintainers; [ xiaoxiangmoe ]; 47 mainProgram = "mdtsql"; 48 }; 49}