Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 testers,
7 oras,
8 versionCheckHook,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "oras";
13 version = "1.2.3";
14
15 src = fetchFromGitHub {
16 owner = "oras-project";
17 repo = "oras";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-IXIw2prApg5iL3BPbOY4x09KjyhFvKofgfz2L6UXKR8=";
20 };
21
22 vendorHash = "sha256-PLGWPoMCsmdnsKD/FdaRHGO0X9/0Y/8DWV21GsCBR04=";
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 excludedPackages = [ "./test/e2e" ];
27
28 ldflags = [
29 "-s"
30 "-w"
31 "-X oras.land/oras/internal/version.Version=${finalAttrs.version}"
32 "-X oras.land/oras/internal/version.BuildMetadata="
33 "-X oras.land/oras/internal/version.GitTreeState=clean"
34 ];
35
36 postInstall = ''
37 installShellCompletion --cmd oras \
38 --bash <($out/bin/oras completion bash) \
39 --fish <($out/bin/oras completion fish) \
40 --zsh <($out/bin/oras completion zsh)
41 '';
42
43 doInstallCheck = true;
44 nativeInstallCheckInputs = [ versionCheckHook ];
45 versionCheckProgramArg = "version";
46
47 meta = {
48 homepage = "https://oras.land/";
49 changelog = "https://github.com/oras-project/oras/releases/tag/v${finalAttrs.version}";
50 description = "ORAS project provides a way to push and pull OCI Artifacts to and from OCI Registries";
51 mainProgram = "oras";
52 license = lib.licenses.asl20;
53 maintainers = with lib.maintainers; [
54 jk
55 developer-guy
56 ];
57 };
58})