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