1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 installShellFiles,
6 stdenv,
7 nix-update-script,
8}:
9
10buildGoModule (finalAttrs: {
11 pname = "temporal-cli";
12 version = "1.4.1";
13
14 src = fetchFromGitHub {
15 owner = "temporalio";
16 repo = "cli";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-fbaqRjYFDeGuCheg3EIUVh/QMhFzLNUb6MUoc/J51Ko=";
19 };
20
21 vendorHash = "sha256-dWcf4X8/Wy/TULdT6PbiMaOd1d+haBlnII+6VKazrD4=";
22
23 overrideModAttrs = old: {
24 # https://gitlab.com/cznic/libc/-/merge_requests/10
25 postBuild = ''
26 patch -p0 < ${./darwin-sandbox-fix.patch}
27 '';
28 };
29
30 nativeBuildInputs = [ installShellFiles ];
31
32 excludedPackages = [
33 "./cmd/docgen"
34 "./tests"
35 ];
36
37 ldflags = [
38 "-s"
39 "-w"
40 "-X github.com/temporalio/cli/temporalcli.Version=${finalAttrs.version}"
41 ];
42
43 # Tests fail with x86 on macOS Rosetta 2
44 doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64);
45
46 preCheck = ''
47 export HOME="$(mktemp -d)"
48 '';
49
50 postInstall = ''
51 installShellCompletion --cmd temporal \
52 --bash <($out/bin/temporal completion bash) \
53 --fish <($out/bin/temporal completion fish) \
54 --zsh <($out/bin/temporal completion zsh)
55 '';
56
57 __darwinAllowLocalNetworking = true;
58
59 passthru.updateScript = nix-update-script { };
60
61 meta = {
62 description = "Command-line interface for running Temporal Server and interacting with Workflows, Activities, Namespaces, and other parts of Temporal";
63 homepage = "https://docs.temporal.io/cli";
64 license = lib.licenses.mit;
65 maintainers = with lib.maintainers; [ aaronjheng ];
66 mainProgram = "temporal";
67 };
68})