supabase-cli: modernize package

- Use versionCheckHook instead of testers.testVersion
- Enable __structuredAttrs
- Use tag instead of rev for fetchFromGitHub
- Drop -w from ldflags
- Flatten passthru
This commit is contained in:
Ilan Joselevich
2026-05-19 19:47:39 +03:00
parent bf4c9c67fd
commit d831d3e723
+13 -15
View File
@@ -3,8 +3,7 @@
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
supabase-cli,
versionCheckHook,
nix-update-script,
}:
@@ -12,10 +11,12 @@ buildGoModule (finalAttrs: {
pname = "supabase-cli";
version = "2.100.1";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "supabase";
repo = "cli";
rev = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}";
hash = "sha256-vCaPZXf4I2f9kJDBDsZcl1q8PIM35NxwuLTeq1aastw=";
};
@@ -26,16 +27,18 @@ buildGoModule (finalAttrs: {
ldflags = [
"-s"
"-w"
"-X=github.com/supabase/cli/internal/utils.Version=${finalAttrs.version}"
];
subPackages = [ "." ];
doCheck = false; # tests are trying to connect to localhost
nativeBuildInputs = [ installShellFiles ];
doCheck = false; # Root Go package does not have any tests.
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
postInstall = ''
mv $out/bin/{cli,supabase}
@@ -45,15 +48,10 @@ buildGoModule (finalAttrs: {
--zsh <($out/bin/supabase completion zsh)
'';
passthru = {
tests.version = testers.testVersion {
package = supabase-cli;
};
updateScript = nix-update-script {
# Fetch versions from GitHub releases to detect pre-releases and
# avoid updating to them.
extraArgs = [ "--use-github-releases" ];
};
passthru.updateScript = nix-update-script {
# Fetch versions from GitHub releases to detect pre-releases and
# avoid updating to them.
extraArgs = [ "--use-github-releases" ];
};
meta = {