1{ lib, buildGoModule, fetchFromGitHub, fetchurl, installShellFiles }:
2
3buildGoModule rec {
4 pname = "cloudfoundry-cli";
5 version = "8.0.0";
6
7 src = fetchFromGitHub {
8 owner = "cloudfoundry";
9 repo = "cli";
10 rev = "v${version}";
11 sha256 = "00cwnfylra0msbb423ad21if98s6smzccsyidqsl4r2mrlkhahwm";
12 };
13 vendorSha256 = "0fcgyyd11xfhn8i11bqnaw3h51bj1y8s37b4d8wzv31dr8zswqsc";
14
15 subPackages = [ "." ];
16
17 # upstream have helpfully moved the bash completion script to a separate
18 # repo which receives no releases or even tags
19 bashCompletionScript = fetchurl {
20 url = "https://raw.githubusercontent.com/cloudfoundry/cli-ci/5f4f0d5d01e89c6333673f0fa96056749e71b3cd/ci/installers/completion/cf8";
21 sha256 = "06w26kpnjd3f2wdjhb4pp0kaq2gb9kf87v7pjd9n2g7s7qhdqyhy";
22 };
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 ldflags = [
27 "-s"
28 "-w"
29 "-X code.cloudfoundry.org/cli/version.binaryBuildDate=1970-01-01"
30 "-X code.cloudfoundry.org/cli/version.binaryVersion=${version}"
31 ];
32
33 postInstall = ''
34 mv "$out/bin/cli" "$out/bin/cf"
35 installShellCompletion --bash $bashCompletionScript
36 '';
37
38 meta = with lib; {
39 description = "The official command line client for Cloud Foundry";
40 homepage = "https://github.com/cloudfoundry/cli";
41 maintainers = with maintainers; [ ris ];
42 license = licenses.asl20;
43 };
44}