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-02 16:24:17 -04:00
parent f1f3b5ec6e
commit 6572a49f3c
No known key found for this signature in database
GPG Key ID: 794D748B8B8BF912

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";