diff --git a/pkgs/by-name/tr/trivy/package.nix b/pkgs/by-name/tr/trivy/package.nix index 4ed0f45e95c9..7946b892bab2 100644 --- a/pkgs/by-name/tr/trivy/package.nix +++ b/pkgs/by-name/tr/trivy/package.nix @@ -5,17 +5,17 @@ buildGoModule, fetchFromGitHub, installShellFiles, - testers, - trivy, + versionCheckHook, }: -buildGoModule rec { + +buildGoModule (finalAttrs: { pname = "trivy"; version = "0.69.0"; src = fetchFromGitHub { owner = "aquasecurity"; repo = "trivy"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-auCbZmVr7LzYrw+IOpXBZPUs2YmcPAzr5fo12vSyHeM="; }; @@ -29,13 +29,15 @@ buildGoModule rec { ldflags = [ "-s" "-w" - "-X=github.com/aquasecurity/trivy/pkg/version/app.ver=${version}" + "-X=github.com/aquasecurity/trivy/pkg/version/app.ver=${finalAttrs.version}" ]; env.GOEXPERIMENT = "jsonv2"; nativeBuildInputs = [ installShellFiles ]; + nativeInstallCheckInputs = [ versionCheckHook ]; + # Tests require network access doCheck = false; @@ -48,16 +50,10 @@ buildGoModule rec { doInstallCheck = true; - passthru.tests.version = testers.testVersion { - package = trivy; - command = "trivy --version"; - version = "Version: ${version}"; - }; - meta = { description = "Simple and comprehensive vulnerability scanner for containers, suitable for CI"; homepage = "https://github.com/aquasecurity/trivy"; - changelog = "https://github.com/aquasecurity/trivy/releases/tag/v${version}"; + changelog = "https://github.com/aquasecurity/trivy/releases/tag/${finalAttrs.src.tag}"; longDescription = '' Trivy is a simple and comprehensive vulnerability scanner for containers and other artifacts. A software vulnerability is a glitch, flaw, or @@ -72,4 +68,4 @@ buildGoModule rec { jk ]; }; -} +})