2021-03-20 03:17:30 +01:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, runCommand, yq-go }:
|
2019-08-23 12:26:08 +02:00
|
|
|
|
2020-02-22 01:39:23 +01:00
|
|
|
buildGoModule rec {
|
2019-08-23 12:26:08 +02:00
|
|
|
pname = "yq-go";
|
2022-11-30 14:54:22 +01:00
|
|
|
version = "4.30.5";
|
2019-08-23 12:26:08 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mikefarah";
|
|
|
|
repo = "yq";
|
2021-08-06 21:50:24 +02:00
|
|
|
rev = "v${version}";
|
2022-11-30 14:54:22 +01:00
|
|
|
sha256 = "sha256-+OMBDWiQXCPVTjE8FhzfVRCyGJ0cEw7TVhcoS4yW/50=";
|
2019-08-23 12:26:08 +02:00
|
|
|
};
|
|
|
|
|
2022-10-30 10:01:11 +01:00
|
|
|
vendorSha256 = "sha256-L3l6wH4bR1/R6MtQTHYsyRE5E/EPnpNwa310zUONo+s=";
|
2020-06-12 01:24:58 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = ''
|
2022-06-21 11:39:53 +02:00
|
|
|
installShellCompletion --cmd yq \
|
|
|
|
--bash <($out/bin/yq shell-completion bash) \
|
|
|
|
--fish <($out/bin/yq shell-completion fish) \
|
|
|
|
--zsh <($out/bin/yq shell-completion zsh)
|
2020-06-12 01:24:58 +02:00
|
|
|
'';
|
2019-08-23 12:26:08 +02:00
|
|
|
|
2021-03-20 03:17:30 +01: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-02 00:20:12 +01:00
|
|
|
meta = with lib; {
|
2019-08-23 12:26:08 +02:00
|
|
|
description = "Portable command-line YAML processor";
|
2020-02-22 01:39:23 +01:00
|
|
|
homepage = "https://mikefarah.gitbook.io/yq/";
|
2021-10-08 10:10:20 +02:00
|
|
|
mainProgram = "yq";
|
2022-06-21 11:39:53 +02:00
|
|
|
license = [ licenses.mit ];
|
|
|
|
maintainers = with maintainers; [ lewo SuperSandro2000 ];
|
2019-08-23 12:26:08 +02:00
|
|
|
};
|
2020-06-12 01:24:58 +02:00
|
|
|
}
|