Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09-beta 55 lines 1.7 kB view raw
1{ stdenv, buildGoPackage, fetchFromGitHub, fetchurl, installShellFiles }: 2 3buildGoPackage rec { 4 pname = "cloudfoundry-cli"; 5 version = "7.0.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 = "0jh4x7xlijp1naak5qyc256zkzlrczl6g4iz94s8wx2zj7np0q5l"; 16 }; 17 18 # upstream have helpfully moved the bash completion script to a separate 19 # repo which receives no releases or even tags 20 bashCompletionScript = fetchurl { 21 url = "https://raw.githubusercontent.com/cloudfoundry/cli-ci/6087781a0e195465a35c79c8e968ae708c6f6351/ci/installers/completion/cf7"; 22 sha256 = "1vhg9jcgaxcvvb4pqnhkf27b3qivs4d3w232j0gbh9393m3qxrvy"; 23 }; 24 25 nativeBuildInputs = [ installShellFiles ]; 26 27 makeTarget = let hps = stdenv.hostPlatform.system; in 28 if hps == "x86_64-darwin" then 29 "out/cf-cli_osx" 30 else if hps == "x86_64-linux" then 31 "out/cf-cli_linux_x86-64" 32 else if hps == "i686-linux" then 33 "out/cf-cli_linux_i686" 34 else 35 throw "make target for this platform unknown"; 36 37 buildPhase = '' 38 cd go/src/${goPackagePath} 39 CF_BUILD_DATE="1970-01-01" make $makeTarget 40 cp $makeTarget out/cf 41 ''; 42 43 installPhase = '' 44 install -Dm555 out/cf "$out/bin/cf" 45 installShellCompletion --bash $bashCompletionScript 46 ''; 47 48 meta = with stdenv.lib; { 49 description = "The official command line client for Cloud Foundry"; 50 homepage = "https://github.com/cloudfoundry/cli"; 51 maintainers = with maintainers; [ ris ]; 52 license = licenses.asl20; 53 platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ]; 54 }; 55}