Unverified Commit 12adaf7d authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

trivy: modernize (#488450)

parents ee77e0a6 b765d82e
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -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
    ];
  };
}
})