sqlc: rewrite & adopt (#351796)

This commit is contained in:
Aleksana
2024-10-28 22:56:30 +08:00
committed by GitHub
4 changed files with 60 additions and 31 deletions
+3
View File
@@ -200,3 +200,6 @@ ce21e97a1f20dee15da85c084f9d1148d84f853b
4cec81a9959ce612b653860dcca53101a36f328a
# Final commit that does the formatting
88b285c01d84de82c0b2b052fd28eaf6709c2d26
# sqlc: format with nixfmt
2bdec131b2bb2c8563f4556d741d34ccb77409e2
+57
View File
@@ -0,0 +1,57 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
sqlc,
}:
let
version = "1.27.0";
in
buildGoModule {
pname = "sqlc";
inherit version;
src = fetchFromGitHub {
owner = "sqlc-dev";
repo = "sqlc";
rev = "v${version}";
hash = "sha256-wxQ+YPsDX0Z6B8whlQ/IaT2dRqapPL8kOuFEc6As1rU=";
};
proxyVendor = true;
vendorHash = "sha256-ndOw3uShF5TngpxYNumoK3H3R9v4crfi5V3ZCoSqW90=";
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)
'';
passthru.tests.version = testers.testVersion {
package = sqlc;
command = "sqlc version";
version = "v${version}";
};
meta = {
description = "Generate type-safe code from SQL";
homepage = "https://sqlc.dev/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "sqlc";
};
}
@@ -1,29 +0,0 @@
{ lib, buildGoModule, fetchFromGitHub }:
let
version = "1.27.0";
in
buildGoModule {
pname = "sqlc";
inherit version;
src = fetchFromGitHub {
owner = "sqlc-dev";
repo = "sqlc";
rev = "v${version}";
hash = "sha256-wxQ+YPsDX0Z6B8whlQ/IaT2dRqapPL8kOuFEc6As1rU=";
};
proxyVendor = true;
vendorHash = "sha256-ndOw3uShF5TngpxYNumoK3H3R9v4crfi5V3ZCoSqW90=";
subPackages = [ "cmd/sqlc" ];
meta = {
description = "Generate type-safe code from SQL";
mainProgram = "sqlc";
homepage = "https://sqlc.dev/";
license = lib.licenses.mit;
maintainers = [ ];
};
}
-2
View File
@@ -18376,8 +18376,6 @@ with pkgs;
sqlboiler-crdb = callPackage ../development/tools/database/sqlboiler-crdb { };
sqlc = callPackage ../development/tools/database/sqlc { };
sqlcheck = callPackage ../development/tools/database/sqlcheck { };
sqlcmd = callPackage ../development/tools/database/sqlcmd { };