gojq: use finalAttrs style

This commit is contained in:
ZHAO Jin-Xiang
2025-05-18 01:22:46 +08:00
parent 94a74b3f88
commit e8664ee4af
+19 -11
View File
@@ -2,19 +2,18 @@
lib,
buildGoModule,
fetchFromGitHub,
testers,
gojq,
installShellFiles,
versionCheckHook,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "gojq";
version = "0.12.17";
src = fetchFromGitHub {
owner = "itchyny";
repo = pname;
rev = "v${version}";
repo = "gojq";
rev = "v${finalAttrs.version}";
hash = "sha256-zJkeghN3btF/fZZeuClHV1ndB/2tTTMljEukMYe7UWU=";
};
@@ -31,16 +30,25 @@ buildGoModule rec {
installShellCompletion --cmd gojq --zsh _gojq
'';
passthru.tests.version = testers.testVersion {
package = gojq;
};
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
postInstallCheck = ''
$out/bin/gojq --help > /dev/null
$out/bin/gojq --raw-output '.values[1]' <<< '{"values":["hello","world"]}' | grep '^world$' > /dev/null
'';
doInstallCheck = true;
meta = {
description = "Pure Go implementation of jq";
homepage = "https://github.com/itchyny/gojq";
changelog = "https://github.com/itchyny/gojq/blob/v${version}/CHANGELOG.md";
changelog = "https://github.com/itchyny/gojq/blob/v${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ aaronjheng ];
maintainers = with lib.maintainers; [
xiaoxiangmoe
aaronjheng
];
mainProgram = "gojq";
};
}
})