blob: eca36eae22f02edbd84d865712807d2a0d3620f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
pname = "sqlc";
version = "1.31.1";
src = fetchFromGitHub {
owner = "sqlc-dev";
repo = "sqlc";
tag = "v${finalAttrs.version}";
hash = "sha256-/skb7p3s9TaQE699UCprk1D6S+G/T8Ek9/ADOtS/n44=";
};
proxyVendor = true;
vendorHash = "sha256-+kSAupLQwTzJdgnhlqulEtRcDj9gqSq8uTnWNyDLZew=";
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";
};
})
|