2020-07-27 21:33:58 +01:00
|
|
|
{ stdenv, buildGoPackage, fetchFromGitHub, fetchurl, installShellFiles }:
|
2017-11-24 12:12:47 +00:00
|
|
|
|
|
|
|
buildGoPackage rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cloudfoundry-cli";
|
2020-07-27 21:33:58 +01:00
|
|
|
version = "7.0.1";
|
2017-11-24 12:12:47 +00:00
|
|
|
|
|
|
|
goPackagePath = "code.cloudfoundry.org/cli";
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2018-04-21 20:57:22 +01:00
|
|
|
owner = "cloudfoundry";
|
|
|
|
repo = "cli";
|
2017-11-24 12:12:47 +00:00
|
|
|
rev = "v${version}";
|
2020-07-27 21:33:58 +01:00
|
|
|
sha256 = "0jh4x7xlijp1naak5qyc256zkzlrczl6g4iz94s8wx2zj7np0q5l";
|
|
|
|
};
|
|
|
|
|
|
|
|
# upstream have helpfully moved the bash completion script to a separate
|
|
|
|
# repo which receives no releases or even tags
|
|
|
|
bashCompletionScript = fetchurl {
|
|
|
|
url = "https://raw.githubusercontent.com/cloudfoundry/cli-ci/6087781a0e195465a35c79c8e968ae708c6f6351/ci/installers/completion/cf7";
|
|
|
|
sha256 = "1vhg9jcgaxcvvb4pqnhkf27b3qivs4d3w232j0gbh9393m3qxrvy";
|
2017-11-24 12:12:47 +00:00
|
|
|
};
|
|
|
|
|
2020-04-27 10:30:47 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2018-12-18 17:53:01 +00:00
|
|
|
makeTarget = let hps = stdenv.hostPlatform.system; in
|
|
|
|
if hps == "x86_64-darwin" then
|
|
|
|
"out/cf-cli_osx"
|
|
|
|
else if hps == "x86_64-linux" then
|
|
|
|
"out/cf-cli_linux_x86-64"
|
|
|
|
else if hps == "i686-linux" then
|
|
|
|
"out/cf-cli_linux_i686"
|
|
|
|
else
|
|
|
|
throw "make target for this platform unknown";
|
|
|
|
|
2018-07-22 20:21:47 +01:00
|
|
|
buildPhase = ''
|
|
|
|
cd go/src/${goPackagePath}
|
2018-12-18 17:53:01 +00:00
|
|
|
CF_BUILD_DATE="1970-01-01" make $makeTarget
|
|
|
|
cp $makeTarget out/cf
|
2017-11-24 12:12:47 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2020-04-28 02:50:57 +01:00
|
|
|
install -Dm555 out/cf "$out/bin/cf"
|
2020-07-27 21:33:58 +01:00
|
|
|
installShellCompletion --bash $bashCompletionScript
|
2017-11-24 12:12:47 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "The official command line client for Cloud Foundry";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/cloudfoundry/cli";
|
2017-11-24 12:12:47 +00:00
|
|
|
maintainers = with maintainers; [ ris ];
|
|
|
|
license = licenses.asl20;
|
2018-12-18 17:53:01 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
2017-11-24 12:12:47 +00:00
|
|
|
};
|
|
|
|
}
|