ytt: refactor (#350668)

This commit is contained in:
Aleksana
2024-10-27 18:37:08 +08:00
committed by GitHub
+30 -8
View File
@@ -1,12 +1,18 @@
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
ytt,
}:
buildGoModule rec {
pname = "ytt";
version = "0.50.0";
src = fetchFromGitHub {
owner = "vmware-tanzu";
repo = "carvel-ytt";
owner = "carvel-dev";
repo = "ytt";
rev = "v${version}";
sha256 = "sha256-57SCBlA2IoBy0iygqunFPBS/nyLtl7e7GlA3vB+ED/4=";
};
@@ -16,11 +22,11 @@ buildGoModule rec {
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-X github.com/vmware-tanzu/carvel-ytt/pkg/version.Version=${version}"
"-s"
"-w"
"-X carvel.dev/ytt/pkg/version.Version=${version}"
];
subPackages = [ "cmd/ytt" ];
postInstall = ''
installShellCompletion --cmd ytt \
--bash <($out/bin/ytt completion bash) \
@@ -28,11 +34,27 @@ buildGoModule rec {
--zsh <($out/bin/ytt completion zsh)
'';
# Once `__structuredArgs` is introduced, integrate checks and
# set some regexes `checkFlags = [ "-skip=TestDataValues.*" ]`
# etc. So far we dont test because passing '*' chars through the Go builder
# is flawed.
doCheck = false;
passthru.tests.version = testers.testVersion {
package = ytt;
command = "ytt --version";
inherit version;
};
meta = with lib; {
description = "YAML templating tool that allows configuration of complex software via reusable templates with user-provided values";
mainProgram = "ytt";
homepage = "https://get-ytt.io";
license = licenses.asl20;
maintainers = with maintainers; [ brodes techknowlogick ];
maintainers = with maintainers; [
brodes
techknowlogick
gabyx
];
};
}