12 src = fetchFromGitHub {
15 rev = "refs/tags/v${version}";
16 hash = "sha256-W+KHJM8o0MJeSzWWyESeDXUWeEh2VVnfYm8W40J906k=";
17 # populate values that require us to use git. By doing this in postFetch we
18 # can delete .git afterwards and maintain better reproducibility of the src.
22 git rev-parse HEAD > $out/COMMIT
23 # 0000-00-00T00:00:00Z
24 date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
25 find "$out" -name .git -print0 | xargs -0 rm -rf
28 # hash mismatch with darwin
31 vendorHash = "sha256-j8QCWQcM1xH48B6xxtbXuh2pWTgtRVEIY+KudIKgPjU=";
33 nativeBuildInputs = [ installShellFiles ];
35 subPackages = [ "cmd/syft" ];
40 "-X=main.version=${version}"
41 "-X=main.gitDescription=v${version}"
42 "-X=main.gitTreeState=clean"
46 # Don't check for updates.
47 substituteInPlace cmd/syft/internal/options/update_check.go \
48 --replace-fail "CheckForAppUpdate: true" "CheckForAppUpdate: false"
52 ldflags+=" -X main.gitCommit=$(cat COMMIT)"
53 ldflags+=" -X main.buildDate=$(cat SOURCE_DATE_EPOCH)"
56 # tests require a running docker instance
60 installShellCompletion --cmd syft \
61 --bash <($out/bin/syft completion bash) \
62 --fish <($out/bin/syft completion fish) \
63 --zsh <($out/bin/syft completion zsh)
66 doInstallCheck = true;
67 installCheckPhase = ''
68 runHook preInstallCheck
71 $out/bin/syft version | grep "${version}"
73 runHook postInstallCheck
77 description = "CLI tool and library for generating a Software Bill of Materials from container images and filesystems";
78 homepage = "https://github.com/anchore/syft";
79 changelog = "https://github.com/anchore/syft/releases/tag/v${version}";
81 A CLI tool and Go library for generating a Software Bill of Materials
82 (SBOM) from container images and filesystems. Exceptional for
83 vulnerability detection when used with a scanner tool like Grype.
85 license = with licenses; [ asl20 ];
86 maintainers = with maintainers; [