2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, git
|
2022-09-30 11:47:45 +00:00
|
|
|
, installShellFiles
|
|
|
|
, testers
|
|
|
|
, faas-cli
|
2022-08-21 13:32:41 +00:00
|
|
|
}:
|
2021-10-28 06:52:43 +00:00
|
|
|
let
|
|
|
|
faasPlatform = platform:
|
|
|
|
let cpuName = platform.parsed.cpu.name; in {
|
|
|
|
"aarch64" = "arm64";
|
|
|
|
"armv7l" = "armhf";
|
2021-12-06 16:07:01 +00:00
|
|
|
"armv6l" = "armhf";
|
2021-10-28 06:52:43 +00:00
|
|
|
}.${cpuName} or cpuName;
|
|
|
|
in
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "faas-cli";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.16.27";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openfaas";
|
|
|
|
repo = "faas-cli";
|
|
|
|
rev = version;
|
2024-05-15 15:35:15 +00:00
|
|
|
sha256 = "sha256-CZvIvvkDfpb4YPQIe5i8vZcmhLu7x0zTQGXCL8SxcvM=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
vendorHash = null;
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
CGO_ENABLED = 0;
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-X github.com/openfaas/faas-cli/version.GitCommit=ref/tags/${version}"
|
2021-10-28 06:52:43 +00:00
|
|
|
"-X github.com/openfaas/faas-cli/version.Version=${version}"
|
2024-01-02 11:29:13 +00:00
|
|
|
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.hostPlatform}"
|
2021-10-28 06:52:43 +00:00
|
|
|
];
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/faas-cli" \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ git ]}
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
installShellCompletion --cmd metal \
|
|
|
|
--bash <($out/bin/faas-cli completion --shell bash) \
|
|
|
|
--zsh <($out/bin/faas-cli completion --shell zsh)
|
2022-08-21 13:32:41 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
command = "${faas-cli}/bin/faas-cli version --short-version --warn-update=false";
|
|
|
|
package = faas-cli;
|
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Official CLI for OpenFaaS ";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "faas-cli";
|
2022-09-30 11:47:45 +00:00
|
|
|
homepage = "https://github.com/openfaas/faas-cli";
|
2021-10-28 06:52:43 +00:00
|
|
|
license = licenses.mit;
|
2022-04-15 01:41:22 +00:00
|
|
|
maintainers = with maintainers; [ welteki techknowlogick ];
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
}
|