nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 79 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildGoModule, 5 fetchFromGitHub, 6 makeWrapper, 7 git, 8 installShellFiles, 9 testers, 10 faas-cli, 11}: 12let 13 faasPlatform = 14 platform: 15 let 16 cpuName = platform.parsed.cpu.name; 17 in 18 { 19 "aarch64" = "arm64"; 20 "armv7l" = "armhf"; 21 "armv6l" = "armhf"; 22 } 23 .${cpuName} or cpuName; 24in 25buildGoModule rec { 26 pname = "faas-cli"; 27 version = "0.18.0"; 28 29 src = fetchFromGitHub { 30 owner = "openfaas"; 31 repo = "faas-cli"; 32 rev = version; 33 sha256 = "sha256-ggDfHqGu17nSxRNZESBLn8MYrvSU+ItQubNdUCAFK1c="; 34 }; 35 36 vendorHash = null; 37 38 env.CGO_ENABLED = 0; 39 40 subPackages = [ "." ]; 41 42 ldflags = [ 43 "-s" 44 "-w" 45 "-X github.com/openfaas/faas-cli/version.GitCommit=ref/tags/${version}" 46 "-X github.com/openfaas/faas-cli/version.Version=${version}" 47 "-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.hostPlatform}" 48 ]; 49 50 nativeBuildInputs = [ 51 makeWrapper 52 installShellFiles 53 ]; 54 55 postInstall = '' 56 wrapProgram "$out/bin/faas-cli" \ 57 --prefix PATH : ${lib.makeBinPath [ git ]} 58 59 installShellCompletion --cmd metal \ 60 --bash <($out/bin/faas-cli completion --shell bash) \ 61 --zsh <($out/bin/faas-cli completion --shell zsh) 62 ''; 63 64 passthru.tests.version = testers.testVersion { 65 command = "${faas-cli}/bin/faas-cli version --short-version --warn-update=false"; 66 package = faas-cli; 67 }; 68 69 meta = { 70 description = "Official CLI for OpenFaaS"; 71 mainProgram = "faas-cli"; 72 homepage = "https://github.com/openfaas/faas-cli"; 73 license = lib.licenses.mit; 74 maintainers = with lib.maintainers; [ 75 welteki 76 techknowlogick 77 ]; 78 }; 79}