504525a148
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
65 lines
1.6 KiB
Nix
65 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, makeWrapper
|
|
, git
|
|
, installShellFiles
|
|
, testers
|
|
, faas-cli
|
|
}:
|
|
let
|
|
faasPlatform = platform:
|
|
let cpuName = platform.parsed.cpu.name; in {
|
|
"aarch64" = "arm64";
|
|
"armv7l" = "armhf";
|
|
"armv6l" = "armhf";
|
|
}.${cpuName} or cpuName;
|
|
in
|
|
buildGoModule rec {
|
|
pname = "faas-cli";
|
|
version = "0.16.21";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "openfaas";
|
|
repo = "faas-cli";
|
|
rev = version;
|
|
sha256 = "sha256-1zdxxd27XXSDcOhQi/um7jQlLZ3x+T09N1p1JJ8qzkk=";
|
|
};
|
|
|
|
vendorHash = null;
|
|
|
|
CGO_ENABLED = 0;
|
|
|
|
subPackages = [ "." ];
|
|
|
|
ldflags = [
|
|
"-s" "-w"
|
|
"-X github.com/openfaas/faas-cli/version.GitCommit=ref/tags/${version}"
|
|
"-X github.com/openfaas/faas-cli/version.Version=${version}"
|
|
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.hostPlatform}"
|
|
];
|
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
|
|
|
postInstall = ''
|
|
wrapProgram "$out/bin/faas-cli" \
|
|
--prefix PATH : ${lib.makeBinPath [ git ]}
|
|
|
|
installShellCompletion --cmd metal \
|
|
--bash <($out/bin/faas-cli completion --shell bash) \
|
|
--zsh <($out/bin/faas-cli completion --shell zsh)
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
command = "${faas-cli}/bin/faas-cli version --short-version --warn-update=false";
|
|
package = faas-cli;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Official CLI for OpenFaaS ";
|
|
homepage = "https://github.com/openfaas/faas-cli";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ welteki techknowlogick ];
|
|
};
|
|
}
|