nixpkgs/pkgs/applications/networking/cluster/ocm/default.nix

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

49 lines
1.2 KiB
Nix
Raw Normal View History

2022-07-06 20:53:30 +00:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, stdenv, testers, ocm }:
buildGoModule rec {
pname = "ocm";
2022-07-06 20:53:30 +00:00
version = "0.1.64";
src = fetchFromGitHub {
owner = "openshift-online";
repo = "ocm-cli";
rev = "v${version}";
2022-07-06 20:53:30 +00:00
sha256 = "sha256-RMXiEXgf8tAdp2d97kaOzXgFCFVkaMhkJF8AHXIEJm8=";
};
2022-07-06 20:53:30 +00:00
vendorSha256 = "sha256-4m5Ej2Ql9+wGqrzvXQkY8fL2I9tYE6Tm6s9+qcZBHQI=";
2022-06-06 13:13:51 +00:00
# Strip the final binary.
ldflags = [ "-s" "-w" ];
2022-07-06 20:53:30 +00:00
nativeBuildInputs = [ installShellFiles ];
# Tests expect the binary to be located in the root directory.
preCheck = ''
ln -s $GOPATH/bin/ocm ocm
'';
2022-06-06 13:13:51 +00:00
# Tests fail in Darwin sandbox.
doCheck = !stdenv.isDarwin;
2022-07-06 20:53:30 +00:00
postInstall = ''
installShellCompletion --cmd ocm \
--bash <($out/bin/ocm completion bash) \
--fish <($out/bin/ocm completion fish) \
--zsh <($out/bin/ocm completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = ocm;
command = "ocm version";
};
meta = with lib; {
description = "CLI for the Red Hat OpenShift Cluster Manager";
license = licenses.asl20;
homepage = "https://github.com/openshift-online/ocm-cli";
maintainers = with maintainers; [ stehessel ];
2022-07-06 20:53:30 +00:00
platforms = platforms.all;
};
}