nixpkgs/pkgs/development/tools/oras/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.5 KiB
Nix
Raw Normal View History

2023-03-06 11:58:55 +00:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, oras }:
2022-03-23 17:24:09 +00:00
buildGoModule rec {
pname = "oras";
2023-09-05 06:53:13 +00:00
version = "1.1.0";
2022-03-23 17:24:09 +00:00
src = fetchFromGitHub {
owner = "oras-project";
repo = "oras";
rev = "v${version}";
2023-09-05 06:53:13 +00:00
hash = "sha256-oWDxrxCrBU0quSpRLXZ0w1COuImVj4FzAmv8574x76o=";
2022-03-23 17:24:09 +00:00
};
2023-01-18 06:43:57 +00:00
2023-09-05 06:53:13 +00:00
vendorHash = "sha256-51keQmj1eGT3rJysnfTWIl8xoHfz3NPL/qXegc3wwNc=";
2023-01-18 06:43:57 +00:00
nativeBuildInputs = [ installShellFiles ];
excludedPackages = [ "./test/e2e" ];
2022-03-23 17:24:09 +00:00
ldflags = [
"-s"
"-w"
2023-01-18 06:43:57 +00:00
"-X oras.land/oras/internal/version.Version=${version}"
"-X oras.land/oras/internal/version.BuildMetadata="
"-X oras.land/oras/internal/version.GitTreeState=clean"
2022-03-23 17:24:09 +00:00
];
2023-01-18 06:43:57 +00:00
postInstall = ''
installShellCompletion --cmd oras \
--bash <($out/bin/oras completion bash) \
--fish <($out/bin/oras completion fish) \
--zsh <($out/bin/oras completion zsh)
'';
2022-03-23 17:24:09 +00:00
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/oras --help
$out/bin/oras version | grep "${version}"
runHook postInstallCheck
'';
2023-01-18 06:43:57 +00:00
passthru.tests.version = testers.testVersion {
package = oras;
command = "oras version";
};
2022-03-23 17:24:09 +00:00
meta = with lib; {
homepage = "https://oras.land/";
changelog = "https://github.com/oras-project/oras/releases/tag/v${version}";
description = "The ORAS project provides a way to push and pull OCI Artifacts to and from OCI Registries";
license = licenses.asl20;
maintainers = with maintainers; [ jk developer-guy ];
2022-03-23 17:24:09 +00:00
};
}