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";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "4.44.3";
|
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}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-bQNa19K4wO2XoSecyfOQKTfHFTxkji1U42bL4k1G7Gg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
vendorHash = "sha256-LsunMHKtyAkTAJhqURoAhIIyW//d37ZW4trr+x/Cd8U=";
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = ''
|
2022-06-26 10:26:21 +00: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-18 07:06:33 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
passthru.tests = {
|
2024-01-02 11:29:13 +00:00
|
|
|
simple = runCommand "${pname}-test" { } ''
|
2021-04-12 18:23:04 +00:00
|
|
|
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/";
|
2023-03-04 12:14:45 +00:00
|
|
|
changelog = "https://github.com/mikefarah/yq/raw/v${version}/release_notes.txt";
|
2021-10-08 15:17:17 +00:00
|
|
|
mainProgram = "yq";
|
2022-06-26 10:26:21 +00:00
|
|
|
license = [ licenses.mit ];
|
|
|
|
maintainers = with maintainers; [ lewo SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-06-18 07:06:33 +00:00
|
|
|
}
|