nixpkgs/pkgs/development/tools/faas-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.6 KiB
Nix
Raw Normal View History

2022-02-24 22:16:19 +00:00
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, makeWrapper
, git
, installShellFiles
, testers
, faas-cli
2022-02-24 22:16:19 +00:00
}:
2021-09-08 07:09:52 +00:00
let
faasPlatform = platform:
let cpuName = platform.parsed.cpu.name; in {
"aarch64" = "arm64";
"armv7l" = "armhf";
2021-11-08 14:46:29 +00:00
"armv6l" = "armhf";
2021-09-08 07:09:52 +00:00
}.${cpuName} or cpuName;
in
buildGoModule rec {
pname = "faas-cli";
2023-02-16 23:52:03 +00:00
version = "0.15.9";
2021-09-08 07:09:52 +00:00
src = fetchFromGitHub {
owner = "openfaas";
repo = "faas-cli";
rev = version;
2023-02-16 23:52:03 +00:00
sha256 = "sha256-DudZOIwpsa7VaOQMJ2P/mfWHWYwESNhDfIUbtMV5Es0=";
2021-09-08 07:09:52 +00:00
};
vendorSha256 = null;
2022-02-24 22:16:19 +00:00
2021-09-08 07:09:52 +00:00
CGO_ENABLED = 0;
subPackages = [ "." ];
ldflags = [
"-s" "-w"
2022-03-10 04:37:24 +00:00
"-X github.com/openfaas/faas-cli/version.GitCommit=ref/tags/${version}"
2021-09-08 07:09:52 +00:00
"-X github.com/openfaas/faas-cli/version.Version=${version}"
2021-11-08 14:46:29 +00:00
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.targetPlatform}"
2021-09-08 07:09:52 +00:00
];
nativeBuildInputs = [ makeWrapper installShellFiles ];
2022-02-24 22:16:19 +00:00
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)
2022-02-24 22:16:19 +00:00
'';
passthru.tests.version = testers.testVersion {
command = "${faas-cli}/bin/faas-cli version --short-version --warn-update=false";
package = faas-cli;
};
2021-09-08 07:09:52 +00:00
meta = with lib; {
description = "Official CLI for OpenFaaS ";
homepage = "https://github.com/openfaas/faas-cli";
2021-09-08 07:09:52 +00:00
license = licenses.mit;
2022-04-05 21:29:05 +00:00
maintainers = with maintainers; [ welteki techknowlogick ];
2021-09-08 07:09:52 +00:00
};
}