From d831d3e72332664bbb680098e3461a8b7ad9c6bf Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Tue, 19 May 2026 19:45:32 +0300 Subject: [PATCH] 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 --- pkgs/by-name/su/supabase-cli/package.nix | 28 +++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/su/supabase-cli/package.nix b/pkgs/by-name/su/supabase-cli/package.nix index 3aead787ef07..4944a52392c1 100644 --- a/pkgs/by-name/su/supabase-cli/package.nix +++ b/pkgs/by-name/su/supabase-cli/package.nix @@ -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 = {