1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 testers,
7}:
8
9buildGoModule (finalAttrs: {
10 pname = "notation";
11 version = "1.3.2";
12
13 src = fetchFromGitHub {
14 owner = "notaryproject";
15 repo = "notation";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-l9A5AwKJ/atN92Oral6PRH2nCbMJ+/ST9weXYRZXWms=";
18 };
19
20 vendorHash = "sha256-WFcy7to3bV3V3bBto5F175PEIxrG9Tj7MuLeBXdSvaM=";
21
22 nativeBuildInputs = [
23 installShellFiles
24 ];
25
26 # This is a Go sub-module and cannot be built directly (e2e tests).
27 excludedPackages = [ "./test" ];
28
29 ldflags = [
30 "-s"
31 "-w"
32 "-X github.com/notaryproject/notation/internal/version.Version=${finalAttrs.version}"
33 "-X github.com/notaryproject/notation/internal/version.BuildMetadata="
34 ];
35
36 postInstall = ''
37 installShellCompletion --cmd notation \
38 --bash <($out/bin/notation completion bash) \
39 --fish <($out/bin/notation completion fish) \
40 --zsh <($out/bin/notation completion zsh)
41 '';
42
43 passthru.tests.version = testers.testVersion {
44 package = finalAttrs.finalPackage;
45 command = "notation version";
46 };
47
48 meta = {
49 description = "CLI tool to sign and verify OCI artifacts and container images";
50 homepage = "https://notaryproject.dev/";
51 license = lib.licenses.asl20;
52 maintainers = with lib.maintainers; [ aaronjheng ];
53 mainProgram = "notation";
54 };
55})