nixpkgs/pkgs/by-name/sq/sqlc/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.2 KiB
Nix
Raw Normal View History

2022-05-13 07:43:32 +00:00
{
lib,
2024-10-28 02:18:14 +00:00
stdenv,
2022-05-13 07:43:32 +00:00
buildGoModule,
fetchFromGitHub,
2024-10-28 02:18:14 +00:00
installShellFiles,
testers,
sqlc,
2022-05-13 07:43:32 +00:00
}:
let
2024-08-06 17:57:47 +00:00
version = "1.27.0";
2022-05-13 07:43:32 +00:00
in
buildGoModule {
pname = "sqlc";
inherit version;
src = fetchFromGitHub {
owner = "sqlc-dev";
2022-05-13 07:43:32 +00:00
repo = "sqlc";
2023-09-07 02:42:26 +00:00
rev = "v${version}";
2024-08-06 17:57:47 +00:00
hash = "sha256-wxQ+YPsDX0Z6B8whlQ/IaT2dRqapPL8kOuFEc6As1rU=";
2022-05-13 07:43:32 +00:00
};
proxyVendor = true;
2024-08-06 17:57:47 +00:00
vendorHash = "sha256-ndOw3uShF5TngpxYNumoK3H3R9v4crfi5V3ZCoSqW90=";
2022-05-13 07:43:32 +00:00
subPackages = [ "cmd/sqlc" ];
2024-10-28 02:18:14 +00:00
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)
'';
passthru.tests.version = testers.testVersion {
package = sqlc;
command = "sqlc version";
version = "v${version}";
};
2022-08-09 07:45:53 +00:00
meta = {
description = "Generate type-safe code from SQL";
2022-05-13 07:43:32 +00:00
homepage = "https://sqlc.dev/";
2022-08-09 07:45:53 +00:00
license = lib.licenses.mit;
2024-10-28 02:18:14 +00:00
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "sqlc";
2022-05-13 07:43:32 +00:00
};
}