1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 gpgme,
6 installShellFiles,
7 pkg-config,
8 testers,
9 openshift,
10}:
11buildGoModule rec {
12 pname = "openshift";
13 version = "4.16.0";
14 gitCommit = "fa84651";
15
16 src = fetchFromGitHub {
17 owner = "openshift";
18 repo = "oc";
19 rev = "fa846511dbeb7e08cf77265056397283c6c896f9";
20 hash = "sha256-mGItCpZQqQOKoNm2amwpHrEIcZdVNirQFa7DGvmnR9s=";
21 };
22
23 vendorHash = null;
24
25 buildInputs = [ gpgme ];
26
27 nativeBuildInputs = [
28 installShellFiles
29 pkg-config
30 ];
31
32 ldflags = [
33 "-s"
34 "-w"
35 "-X github.com/openshift/oc/pkg/version.commitFromGit=${gitCommit}"
36 "-X github.com/openshift/oc/pkg/version.versionFromGit=v${version}"
37 ];
38
39 doCheck = false;
40
41 postInstall = ''
42 # Install man pages.
43 mkdir -p man
44 $out/bin/genman man oc
45 installManPage man/*.1
46
47 # Remove unwanted tooling.
48 rm $out/bin/clicheck $out/bin/gendocs $out/bin/genman
49
50 # Install shell completions.
51 installShellCompletion --cmd oc \
52 --bash <($out/bin/oc completion bash) \
53 --fish <($out/bin/oc completion fish) \
54 --zsh <($out/bin/oc completion zsh)
55 '';
56
57 passthru.tests.version = testers.testVersion {
58 package = openshift;
59 command = "oc version";
60 version = "v${version}";
61 };
62
63 meta = with lib; {
64 description = "Build, deploy, and manage your applications with Docker and Kubernetes";
65 homepage = "http://www.openshift.org";
66 license = licenses.asl20;
67 maintainers = with maintainers; [
68 offline
69 moretea
70 stehessel
71 ];
72 mainProgram = "oc";
73 };
74}