Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildGoModule, 5 fetchFromGitHub, 6 installShellFiles, 7 versionCheckHook, 8}: 9 10buildGoModule (finalAttrs: { 11 pname = "sqlc"; 12 version = "1.29.0"; 13 14 src = fetchFromGitHub { 15 owner = "sqlc-dev"; 16 repo = "sqlc"; 17 tag = "v${finalAttrs.version}"; 18 hash = "sha256-BaEvmvbo6OQ1T9lgIuNJMyvnvVZd/20mFEMQdFtxdZc="; 19 }; 20 21 proxyVendor = true; 22 vendorHash = "sha256-LpF94Jv7kukSa803WCmnO+y6kvHLPz0ZGEdbjwVFV40="; 23 24 subPackages = [ "cmd/sqlc" ]; 25 26 nativeBuildInputs = [ installShellFiles ]; 27 28 ldflags = [ 29 "-s" 30 "-w" 31 ]; 32 33 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 34 installShellCompletion --cmd sqlc \ 35 --bash <($out/bin/sqlc completion bash) \ 36 --fish <($out/bin/sqlc completion fish) \ 37 --zsh <($out/bin/sqlc completion zsh) 38 ''; 39 40 doInstallCheck = true; 41 nativeInstallCheckInputs = [ versionCheckHook ]; 42 versionCheckProgramArg = "version"; 43 44 meta = { 45 description = "Generate type-safe code from SQL"; 46 homepage = "https://sqlc.dev/"; 47 license = lib.licenses.mit; 48 maintainers = with lib.maintainers; [ aaronjheng ]; 49 mainProgram = "sqlc"; 50 }; 51})