hut: add versionCheckHook

Also fixes the embedded version string which was clarified [1] shall not
include the 'v' prefix.

[1]: https://todo.sr.ht/~xenrox/hut/72
This commit is contained in:
nicknb
2026-06-03 20:59:32 +02:00
parent 82be2412cd
commit 29af01593b
+11 -2
View File
@@ -3,6 +3,7 @@
buildGoModule,
fetchFromSourcehut,
scdoc,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
@@ -18,6 +19,14 @@ buildGoModule (finalAttrs: {
vendorHash = "sha256-7N+Zn7tzEG3dGeqNWmY98XUUKV7Y6g8wFZcQP9wea/8=";
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "version";
doInstallCheck = true;
nativeBuildInputs = [
scdoc
];
@@ -25,8 +34,8 @@ buildGoModule (finalAttrs: {
makeFlags = [ "PREFIX=$(out)" ];
ldflags = [
# Recommended in 0.8.0 release notes https://git.sr.ht/~xenrox/hut/refs/v0.8.0
"-X main.version=v${finalAttrs.version}"
# Recommended in 0.7.0 release notes https://git.sr.ht/~xenrox/hut/refs/v0.7.0
"-X main.version=${finalAttrs.version}"
];
postBuild = ''