natscli: set main.version=${version}

Otherwise, `natscli --version` reports its version as "development"
instead of the version number.

Adds versionCheckHook to verify.
This commit is contained in:
Cody P Schafer
2024-10-13 12:25:40 -04:00
parent f1f3b5ec6e
commit 6572a49f3c
+9
View File
@@ -1,6 +1,7 @@
{ lib
, buildGoModule
, fetchFromGitHub
, versionCheckHook
}:
buildGoModule rec {
@@ -16,6 +17,14 @@ buildGoModule rec {
vendorHash = "sha256-T6VcyklwfRS012ZRzqxkahn9YYrQGky/znTqLIkAoK0=";
ldflags = [
"-X main.version=${version}"
];
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/nats";
meta = with lib; {
description = "NATS Command Line Interface";
homepage = "https://github.com/nats-io/natscli";