diff --git a/pkgs/by-name/kn/kn/package.nix b/pkgs/by-name/kn/kn/package.nix index eee5c96d2cd7..5461596d9ab2 100644 --- a/pkgs/by-name/kn/kn/package.nix +++ b/pkgs/by-name/kn/kn/package.nix @@ -2,31 +2,30 @@ lib, buildGoModule, fetchFromGitHub, + getent, installShellFiles, }: -buildGoModule rec { +buildGoModule (finalAttrs: { pname = "kn"; - version = "1.15.0"; + version = "1.18.0"; src = fetchFromGitHub { owner = "knative"; repo = "client"; - rev = "knative-v${version}"; - sha256 = "sha256-bXICU1UBNPVIumzRPSOWa1I5hUYWEvo6orBpUvbPEvg="; + tag = "knative-v${finalAttrs.version}"; + hash = "sha256-Hi5MIzOTL8B1gL+UNv/G18VkBXflSObzCaZZALjWjw0="; }; - vendorHash = null; + vendorHash = "sha256-bgZi5SdedpqqAdkl+iP1gqXonEMSrHjXKV2QRijvrtE="; + + env.GOWORK = "off"; subPackages = [ "cmd/kn" ]; nativeBuildInputs = [ installShellFiles ]; - ldflags = [ - "-X knative.dev/client/pkg/kn/commands/version.Version=v${version}" - "-X knative.dev/client/pkg/kn/commands/version.VersionEventing=v${version}" - "-X knative.dev/client/pkg/kn/commands/version.VersionServing=v${version}" - ]; + ldflags = [ "-X knative.dev/client/pkg/commands/version.Version=v${finalAttrs.version}" ]; postInstall = '' installShellCompletion --cmd kn \ @@ -35,16 +34,21 @@ buildGoModule rec { ''; doInstallCheck = true; + installCheckPhase = '' - $out/bin/kn version | grep ${version} > /dev/null + runHook preInstallCheck + + PATH=$PATH:${getent}/bin $out/bin/kn version | grep ${finalAttrs.version} > /dev/null + + runHook postInstallCheck ''; - meta = with lib; { - description = "Knative client kn is your door to the Knative world. It allows you to create Knative resources interactively from the command line or from within scripts"; + meta = { + description = "Create Knative resources interactively from the command line or from within scripts"; mainProgram = "kn"; homepage = "https://github.com/knative/client"; - changelog = "https://github.com/knative/client/releases/tag/v${version}"; - license = licenses.asl20; - maintainers = with maintainers; [ bryanasdev000 ]; + changelog = "https://github.com/knative/client/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bryanasdev000 ]; }; -} +})