1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 testers,
8 copilot-cli,
9}:
10
11buildGoModule rec {
12 pname = "copilot-cli";
13 version = "1.34.1";
14
15 src = fetchFromGitHub {
16 owner = "aws";
17 repo = "copilot-cli";
18 rev = "v${version}";
19 hash = "sha256-Oxt1+0z+woNPsFuCkj4t71/e21mHtoCd281BwbHCGc8=";
20 };
21
22 vendorHash = "sha256-ZdYuQAdjzvxxqKHoiHfhfJff3OfEE7ciIGcX1W3jVXY=";
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 # follow LINKER_FLAGS in Makefile
27 ldflags = [
28 "-s"
29 "-w"
30 "-X github.com/aws/copilot-cli/internal/pkg/version.Version=v${version}"
31 "-X github.com/aws/copilot-cli/internal/pkg/cli.binaryS3BucketPath=https://ecs-cli-v2-release.s3.amazonaws.com"
32 ];
33
34 subPackages = [ "./cmd/copilot" ];
35
36 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
37 installShellCompletion --cmd copilot \
38 --bash <($out/bin/copilot completion bash) \
39 --fish <($out/bin/copilot completion fish) \
40 --zsh <($out/bin/copilot completion zsh)
41 '';
42
43 passthru.tests.version = testers.testVersion {
44 package = copilot-cli;
45 command = "copilot version";
46 version = "v${version}";
47 };
48
49 meta = {
50 description = "Build, Release and Operate Containerized Applications on AWS";
51 homepage = "https://github.com/aws/copilot-cli";
52 changelog = "https://github.com/aws/copilot-cli/releases/tag/v${version}";
53 license = lib.licenses.asl20;
54 maintainers = with lib.maintainers; [ jiegec ];
55 mainProgram = "copilot";
56 };
57}