nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, buildGoPackage, fetchFromGitHub }:
2
3buildGoPackage rec {
4 pname = "cloudfoundry-cli";
5 version = "6.46.1";
6
7 goPackagePath = "code.cloudfoundry.org/cli";
8
9 subPackages = [ "." ];
10
11 src = fetchFromGitHub {
12 owner = "cloudfoundry";
13 repo = "cli";
14 rev = "v${version}";
15 sha256 = "0dqrkimwhw016icgyf4cyipzy6vdz5jgickm33xxd9018dh3ibwq";
16 };
17
18 makeTarget = let hps = stdenv.hostPlatform.system; in
19 if hps == "x86_64-darwin" then
20 "out/cf-cli_osx"
21 else if hps == "x86_64-linux" then
22 "out/cf-cli_linux_x86-64"
23 else if hps == "i686-linux" then
24 "out/cf-cli_linux_i686"
25 else
26 throw "make target for this platform unknown";
27
28 buildPhase = ''
29 cd go/src/${goPackagePath}
30 CF_BUILD_DATE="1970-01-01" make $makeTarget
31 cp $makeTarget out/cf
32 '';
33
34 installPhase = ''
35 install -Dm555 out/cf "$bin/bin/cf"
36 install -Dm444 -t "$bin/share/bash-completion/completions/" "$src/ci/installers/completion/cf"
37 '';
38
39 meta = with stdenv.lib; {
40 description = "The official command line client for Cloud Foundry";
41 homepage = https://github.com/cloudfoundry/cli;
42 maintainers = with maintainers; [ ris ];
43 license = licenses.asl20;
44 platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
45 };
46}