2021-03-20 02:17:30 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, runCommand, yq-go }:
|
2019-08-23 10:26:08 +00:00
|
|
|
|
2020-02-22 00:39:23 +00:00
|
|
|
buildGoModule rec {
|
2019-08-23 10:26:08 +00:00
|
|
|
pname = "yq-go";
|
2022-02-28 11:01:19 +00:00
|
|
|
version = "4.21.1";
|
2019-08-23 10:26:08 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mikefarah";
|
|
|
|
repo = "yq";
|
2021-08-06 19:50:24 +00:00
|
|
|
rev = "v${version}";
|
2022-02-28 11:01:19 +00:00
|
|
|
sha256 = "sha256-283xe7FVHYSsRl4cZD7WDzIW1gqNAFsNrWYJkthZheU=";
|
2019-08-23 10:26:08 +00:00
|
|
|
};
|
|
|
|
|
2022-02-28 11:01:19 +00:00
|
|
|
vendorSha256 = "sha256-F11FnDYJ59aKrdRXDPpKlhX52yQXdaN1sblSkVI2j9w=";
|
2020-06-11 23:24:58 +00:00
|
|
|
|
2020-08-04 00:26:27 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-06-11 23:24:58 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for shell in bash fish zsh; do
|
2021-01-19 05:58:34 +00:00
|
|
|
$out/bin/yq shell-completion $shell > yq.$shell
|
2020-06-11 23:24:58 +00:00
|
|
|
installShellCompletion yq.$shell
|
|
|
|
done
|
|
|
|
'';
|
2019-08-23 10:26:08 +00:00
|
|
|
|
2021-03-20 02:17:30 +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-03-01 23:20:12 +00:00
|
|
|
meta = with lib; {
|
2019-08-23 10:26:08 +00:00
|
|
|
description = "Portable command-line YAML processor";
|
2020-02-22 00:39:23 +00:00
|
|
|
homepage = "https://mikefarah.gitbook.io/yq/";
|
2019-08-23 10:26:08 +00:00
|
|
|
license = [ licenses.mit ];
|
|
|
|
maintainers = [ maintainers.lewo ];
|
2021-10-08 08:10:20 +00:00
|
|
|
mainProgram = "yq";
|
2019-08-23 10:26:08 +00:00
|
|
|
};
|
2020-06-11 23:24:58 +00:00
|
|
|
}
|