summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/openshift/default.nix
blob: 1985d6ad3f2a63cd0446b8bba35bc239fc15098c (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
{ stdenv, fetchFromGitHub, go, which }:

let
  version = "1.3.0";
  versionMajor = "1";
  versionMinor = "3";
in
stdenv.mkDerivation rec {
  name = "openshift-origin-${version}";
  inherit version;

  src = fetchFromGitHub {
    owner = "openshift";
    repo = "origin";
    rev = "v${version}";
    sha256 = "07s7xv8x8pch68j7lsw29im0axi07x32ag9wh9aqa0y570q9xgxy";
  };

  buildInputs = [ go which ];

  patchPhase = ''
    patchShebangs ./hack
  '';

  buildPhase = ''
    export GOPATH=$(pwd)
    # Openshift build require this variables to be set
    # unless there is a .git folder which is not the case with fetchFromGitHub
    export OS_GIT_VERSION=${version}
    export OS_GIT_MAJOR=${versionMajor}
    export OS_GIT_MINOR=${versionMinor}
    make build
  '';

  installPhase = ''
    export GOOS=$(go env GOOS)
    export GOARCH=$(go env GOARCH)
    mkdir -p "$out/bin"
    mv _output/local/bin/$GOOS/$GOARCH/* "$out/bin/"
  '';

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