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