2021-04-12 18:23:04 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, runCommand, yq-go }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "yq-go";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "4.24.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mikefarah";
|
|
|
|
repo = "yq";
|
2021-08-08 23:34:03 +00:00
|
|
|
rev = "v${version}";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-KuaIGIDXdL0d+Wxy2O78XTSBo+2oIrcizfd2jyXghXc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
vendorSha256 = "sha256-R40zU0jOc/eIFVDsWG3+4o51iro7Sd7jwtyH/fpWVZs=";
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for shell in bash fish zsh; do
|
2021-02-05 17:12:51 +00:00
|
|
|
$out/bin/yq shell-completion $shell > yq.$shell
|
2020-06-18 07:06:33 +00:00
|
|
|
installShellCompletion yq.$shell
|
|
|
|
done
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
passthru.tests = {
|
|
|
|
simple = runCommand "${pname}-test" {} ''
|
|
|
|
echo "test: 1" | ${yq-go}/bin/yq eval -j > $out
|
|
|
|
[ "$(cat $out | tr -d $'\n ')" = '{"test":1}' ]
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Portable command-line YAML processor";
|
|
|
|
homepage = "https://mikefarah.gitbook.io/yq/";
|
|
|
|
license = [ licenses.mit ];
|
|
|
|
maintainers = [ maintainers.lewo ];
|
2021-10-08 15:17:17 +00:00
|
|
|
mainProgram = "yq";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-06-18 07:06:33 +00:00
|
|
|
}
|