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