nixpkgs/pkgs/applications/networking/cluster/cloudfoundry-cli/default.nix
2021-10-10 18:53:22 +01:00

45 lines
1.3 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, fetchurl, installShellFiles }:
buildGoModule rec {
pname = "cloudfoundry-cli";
version = "8.0.0";
src = fetchFromGitHub {
owner = "cloudfoundry";
repo = "cli";
rev = "v${version}";
sha256 = "00cwnfylra0msbb423ad21if98s6smzccsyidqsl4r2mrlkhahwm";
};
vendorSha256 = "0fcgyyd11xfhn8i11bqnaw3h51bj1y8s37b4d8wzv31dr8zswqsc";
subPackages = [ "." ];
# 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/5f4f0d5d01e89c6333673f0fa96056749e71b3cd/ci/installers/completion/cf8";
sha256 = "06w26kpnjd3f2wdjhb4pp0kaq2gb9kf87v7pjd9n2g7s7qhdqyhy";
};
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X code.cloudfoundry.org/cli/version.binaryBuildDate=1970-01-01"
"-X code.cloudfoundry.org/cli/version.binaryVersion=${version}"
];
postInstall = ''
mv "$out/bin/cli" "$out/bin/cf"
installShellCompletion --bash $bashCompletionScript
'';
meta = with lib; {
description = "The official command line client for Cloud Foundry";
homepage = "https://github.com/cloudfoundry/cli";
maintainers = with maintainers; [ ris ];
license = licenses.asl20;
};
}