{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles, versionCheckHook, }: buildGoModule (finalAttrs: { pname = "sqlc"; version = "1.29.0"; src = fetchFromGitHub { owner = "sqlc-dev"; repo = "sqlc"; tag = "v${finalAttrs.version}"; hash = "sha256-BaEvmvbo6OQ1T9lgIuNJMyvnvVZd/20mFEMQdFtxdZc="; }; proxyVendor = true; vendorHash = "sha256-LpF94Jv7kukSa803WCmnO+y6kvHLPz0ZGEdbjwVFV40="; subPackages = [ "cmd/sqlc" ]; nativeBuildInputs = [ installShellFiles ]; ldflags = [ "-s" "-w" ]; postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sqlc \ --bash <($out/bin/sqlc completion bash) \ --fish <($out/bin/sqlc completion fish) \ --zsh <($out/bin/sqlc completion zsh) ''; doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgramArg = "version"; meta = { description = "Generate type-safe code from SQL"; homepage = "https://sqlc.dev/"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ aaronjheng ]; mainProgram = "sqlc"; }; })