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

42 lines
1.0 KiB
Nix
Raw Normal View History

2021-03-20 02:17:30 +00:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, runCommand, yq-go }:
2019-08-23 11:26:08 +01:00
2020-02-22 00:39:23 +00:00
buildGoModule rec {
2019-08-23 11:26:08 +01:00
pname = "yq-go";
2021-12-06 05:29:45 +00:00
version = "4.16.1";
2019-08-23 11:26:08 +01:00
src = fetchFromGitHub {
owner = "mikefarah";
repo = "yq";
2021-08-06 20:50:24 +01:00
rev = "v${version}";
2021-12-06 05:29:45 +00:00
sha256 = "sha256-4o38f5ltTH6ea0na919GnJMao8w5rgkDWMp2mkoKwcY=";
2019-08-23 11:26:08 +01:00
};
2021-12-06 05:29:45 +00:00
vendorSha256 = "sha256-PCDM1VbqUcAVXzCPWDZtCRLpRIu43sF1lGazAG2HZJ0=";
doCheck = false;
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
installShellCompletion yq.$shell
done
'';
2019-08-23 11:26:08 +01: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 11:26:08 +01:00
description = "Portable command-line YAML processor";
2020-02-22 00:39:23 +00:00
homepage = "https://mikefarah.gitbook.io/yq/";
2019-08-23 11:26:08 +01:00
license = [ licenses.mit ];
maintainers = [ maintainers.lewo ];
2021-10-08 09:10:20 +01:00
mainProgram = "yq";
2019-08-23 11:26:08 +01:00
};
}