16 src = fetchFromGitHub {
17 owner = "aquasecurity";
20 hash = "sha256-DIBpuSW8igkpZxhve77fzJ1u3sp3iWHmi7746F0cKEQ=";
23 # Hash mismatch on across Linux and Darwin
26 vendorHash = "sha256-kRKGX3hRbjLb/thhFcX4/y1ty0EGME63VGOsPaUcZKc=";
28 subPackages = [ "cmd/trivy" ];
33 "-X=github.com/aquasecurity/trivy/pkg/version/app.ver=${version}"
36 nativeBuildInputs = [ installShellFiles ];
38 # Tests require network access
44 if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
50 installShellCompletion --cmd trivy \
51 --bash <(${trivy}/bin/trivy completion bash) \
52 --fish <(${trivy}/bin/trivy completion fish) \
53 --zsh <(${trivy}/bin/trivy completion zsh)
56 doInstallCheck = true;
58 passthru.tests.version = testers.testVersion {
60 command = "trivy --version";
61 version = "Version: ${version}";
65 description = "Simple and comprehensive vulnerability scanner for containers, suitable for CI";
66 homepage = "https://github.com/aquasecurity/trivy";
67 changelog = "https://github.com/aquasecurity/trivy/releases/tag/v${version}";
69 Trivy is a simple and comprehensive vulnerability scanner for containers
70 and other artifacts. A software vulnerability is a glitch, flaw, or
71 weakness present in the software or in an Operating System. Trivy detects
72 vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and
73 application dependencies (Bundler, Composer, npm, yarn, etc.).
75 mainProgram = "trivy";
76 license = licenses.asl20;
77 maintainers = with maintainers; [