2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, git
|
|
|
|
}:
|
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";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "0.14.6";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openfaas";
|
|
|
|
repo = "faas-cli";
|
|
|
|
rev = version;
|
2022-09-09 14:08:57 +00:00
|
|
|
sha256 = "sha256-R9nusKdZpKZmUcEUchZlj7Jd5sM/Z2SScdK6kO6Ht2o=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
CGO_ENABLED = 0;
|
|
|
|
|
|
|
|
vendorSha256 = null;
|
|
|
|
|
|
|
|
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}"
|
2021-12-06 16:07:01 +00:00
|
|
|
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.targetPlatform}"
|
2021-10-28 06:52:43 +00:00
|
|
|
];
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/faas-cli" \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ git ]}
|
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/openfaas/faas-cli";
|
|
|
|
description = "Official CLI for OpenFaaS ";
|
|
|
|
license = licenses.mit;
|
2022-04-15 01:41:22 +00:00
|
|
|
maintainers = with maintainers; [ welteki techknowlogick ];
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
}
|