summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/openshift/default.nix
blob: bab73c41f5f59297d69bf3e10377b6323e5f17bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, buildGoModule
, fetchFromGitHub
, libkrb5
, git
, installShellFiles
, testers
, openshift
}:

buildGoModule rec {
  pname = "openshift";
  version = "4.10.0";
  gitCommit = "346b183";

  src = fetchFromGitHub {
    owner = "openshift";
    repo = "oc";
    rev = "release-4.10";
    sha256 = "Pdq3OwT5P7vvB70X+GVglT9CdJbhkm35nvEGurO1HPc=";
  };

  vendorSha256 = null;

  buildInputs = [ libkrb5 ];

  nativeBuildInputs = [ installShellFiles ];

  patchPhase = ''
    patchShebangs ./hack
  '';

  buildPhase = ''
    # Openshift build require this variables to be set
    # unless there is a .git folder which is not the case with fetchFromGitHub
    export SOURCE_GIT_COMMIT=${gitCommit}
    export SOURCE_GIT_TAG=v${version}
    export SOURCE_GIT_TREE_STATE=clean

    make all
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp oc $out/bin

    mkdir -p man
    ./genman man oc
    installManPage man/*.1

    installShellCompletion --bash contrib/completions/bash/*
    installShellCompletion --zsh contrib/completions/zsh/*
  '';

  passthru.tests.version = testers.testVersion {
    package = openshift;
    command = "oc version";
    version = "v${version}";
  };

  meta = with lib; {
    description = "Build, deploy, and manage your applications with Docker and Kubernetes";
    license = licenses.asl20;
    homepage = "http://www.openshift.org";
    maintainers = with maintainers; [ offline bachp moretea stehessel ];
    platforms = platforms.unix;
  };
}