From f919d20f12a2e38d4e20ed11d132ed92a9edea2f Mon Sep 17 00:00:00 2001 From: kilianar <105428155+kilianar@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:28:16 +0100 Subject: [PATCH] lazysql: fix incorrect version output (#353654) * lazysql: fix version display in `lazysql version` command Sets `main.version` using `ldflags` to ensure `lazysql version` shows the correct version instead of "dev". * lazysql: add passthru.tests.version To address previous issues where lazygit incorrectly reported its version as "dev," this commit introduces `passthru.tests.version` for lazysql. This test verifies that the version command for lazysql (`lazysql version`) correctly reports the expected version. --- pkgs/by-name/la/lazysql/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/la/lazysql/package.nix b/pkgs/by-name/la/lazysql/package.nix index a5aed8158ae3..dc3ecec1acc8 100644 --- a/pkgs/by-name/la/lazysql/package.nix +++ b/pkgs/by-name/la/lazysql/package.nix @@ -2,6 +2,8 @@ , stdenv , buildGoModule , fetchFromGitHub +, testers +, lazysql , xorg ? null , darwin ? null }: @@ -19,8 +21,17 @@ buildGoModule rec { vendorHash = "sha256-SKNFViwoMzZ1hKKZSvTm0/kKro1IaUVsC+0Pbv7FoAU="; + ldflags = [ + "-X main.version=${version}" + ]; + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ xorg.libX11 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]; + passthru.tests.version = testers.testVersion { + package = lazysql; + command = "lazysql version"; + }; + meta = with lib; { description = "A cross-platform TUI database management tool written in Go"; homepage = "https://github.com/jorgerojas26/lazysql";