nixpkgs/pkgs/development/tools/yq-go/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Nix
Raw Normal View History

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-10-06 02:43:12 +00:00
version = "4.28.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-10-06 02:43:12 +00:00
sha256 = "sha256-GWEsS5RTwz0VVLRAvHPJk0BPo50RB0CeyIS6fne9GoU=";
2019-08-23 10:26:08 +00:00
};
2022-09-09 12:04:49 +00:00
vendorSha256 = "sha256-4J/Qz5JN8UUdwa3/Io2/o4Y01eFK9zOcNAZkndzI178=";
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
2022-06-21 09:39:53 +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)
'';
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}' ]
'';
};
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/";
2021-10-08 08:10:20 +00:00
mainProgram = "yq";
2022-06-21 09:39:53 +00:00
license = [ licenses.mit ];
maintainers = with maintainers; [ lewo SuperSandro2000 ];
2019-08-23 10:26:08 +00:00
};
}