Files
nixpkgs/pkgs/by-name/hu/hut/package.nix
nicknb 29af01593b 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
2026-06-03 20:59:32 +02:00

57 lines
1.1 KiB
Nix

{
lib,
buildGoModule,
fetchFromSourcehut,
scdoc,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
pname = "hut";
version = "0.8.0";
src = fetchFromSourcehut {
owner = "~xenrox";
repo = "hut";
rev = "v${finalAttrs.version}";
hash = "sha256-dbFqc+zlUihf/gz4Oo3LtbOClDDDB/khlCbI9/UgD2E=";
};
vendorHash = "sha256-7N+Zn7tzEG3dGeqNWmY98XUUKV7Y6g8wFZcQP9wea/8=";
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "version";
doInstallCheck = true;
nativeBuildInputs = [
scdoc
];
makeFlags = [ "PREFIX=$(out)" ];
ldflags = [
# Recommended in 0.7.0 release notes https://git.sr.ht/~xenrox/hut/refs/v0.7.0
"-X main.version=${finalAttrs.version}"
];
postBuild = ''
make $makeFlags completions doc/hut.1
'';
preInstall = ''
make $makeFlags install
'';
meta = {
homepage = "https://sr.ht/~xenrox/hut/";
description = "CLI tool for Sourcehut / sr.ht";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ fgaz ];
mainProgram = "hut";
};
})