nixpkgs/pkgs/by-name/yq/yq-go/package.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d5c88a98d674f637d092807cfc12253.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
2025-04-08 02:57:25 -04:00

52 lines
1.3 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
runCommand,
yq-go,
}:
buildGoModule rec {
pname = "yq-go";
version = "4.45.1";
src = fetchFromGitHub {
owner = "mikefarah";
repo = "yq";
rev = "v${version}";
hash = "sha256-AsTDbeRMb6QJE89Z0NGooyTY3xZpWFoWkT7dofsu0DI=";
};
vendorHash = "sha256-d4dwhZYzEuyh1zJQ2xU0WkygHjoVLoCBrDKuAHUzu1w=";
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd yq \
--bash <($out/bin/yq shell-completion bash) \
--fish <($out/bin/yq shell-completion fish) \
--zsh <($out/bin/yq shell-completion zsh)
'';
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; {
description = "Portable command-line YAML processor";
homepage = "https://mikefarah.gitbook.io/yq/";
changelog = "https://github.com/mikefarah/yq/raw/v${version}/release_notes.txt";
mainProgram = "yq";
license = [ licenses.mit ];
maintainers = with maintainers; [
lewo
SuperSandro2000
];
};
}