2023-07-31 22:34:02 +00:00
|
|
|
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, symlinkJoin, stdenv }:
|
2022-05-15 03:52:48 +00:00
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
let
|
2023-07-24 14:44:55 +00:00
|
|
|
metaCommon = with lib; {
|
|
|
|
description = "Command-line interface for running Temporal Server and interacting with Workflows, Activities, Namespaces, and other parts of Temporal";
|
|
|
|
homepage = "https://docs.temporal.io/cli";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ aaronjheng ];
|
|
|
|
};
|
|
|
|
|
2023-07-10 21:53:45 +00:00
|
|
|
overrideModAttrs = old: {
|
|
|
|
# https://gitlab.com/cznic/libc/-/merge_requests/10
|
|
|
|
postBuild = ''
|
|
|
|
patch -p0 < ${./darwin-sandbox-fix.patch}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
tctl-next = buildGoModule rec {
|
|
|
|
pname = "tctl-next";
|
2024-08-26 16:50:11 +00:00
|
|
|
version = "1.0.0";
|
2023-02-06 11:52:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "temporalio";
|
|
|
|
repo = "cli";
|
|
|
|
rev = "v${version}";
|
2024-08-26 16:50:11 +00:00
|
|
|
hash = "sha256-y0C2z2iMMQSG5+xGngZ98+ixIgbvaQxPdAWuPbEbBAY=";
|
2023-02-06 11:52:59 +00:00
|
|
|
};
|
|
|
|
|
2024-08-26 16:50:11 +00:00
|
|
|
vendorHash = "sha256-zhGqDHdVGg7eGnw5L3eSyXKBTjp85ir5zrtf7HbXmC0=";
|
2023-07-10 21:53:45 +00:00
|
|
|
|
|
|
|
inherit overrideModAttrs;
|
2023-02-06 11:52:59 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2023-05-13 04:37:50 +00:00
|
|
|
excludedPackages = [ "./cmd/docgen" "./tests" ];
|
2023-02-06 11:52:59 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2024-08-26 16:50:11 +00:00
|
|
|
"-X github.com/temporalio/cli/temporalcli.Version=${version}"
|
2023-02-06 11:52:59 +00:00
|
|
|
];
|
|
|
|
|
2023-07-31 22:34:02 +00:00
|
|
|
# Tests fail with x86 on macOS Rosetta 2
|
|
|
|
doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64);
|
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
preCheck = ''
|
2024-05-19 12:35:33 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2023-02-06 11:52:59 +00:00
|
|
|
'';
|
2022-05-15 03:52:48 +00:00
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd temporal \
|
|
|
|
--bash <($out/bin/temporal completion bash) \
|
2024-05-13 00:06:44 +00:00
|
|
|
--fish <($out/bin/temporal completion fish) \
|
2023-02-06 11:52:59 +00:00
|
|
|
--zsh <($out/bin/temporal completion zsh)
|
|
|
|
'';
|
2023-07-10 21:53:45 +00:00
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
2023-07-24 14:44:55 +00:00
|
|
|
|
|
|
|
meta = metaCommon // {
|
|
|
|
mainProgram = "temporal";
|
|
|
|
};
|
2022-05-15 03:52:48 +00:00
|
|
|
};
|
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
tctl = buildGoModule rec {
|
|
|
|
pname = "tctl";
|
2024-05-19 12:35:33 +00:00
|
|
|
version = "1.18.1";
|
2022-05-15 03:52:48 +00:00
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "temporalio";
|
|
|
|
repo = "tctl";
|
|
|
|
rev = "v${version}";
|
2024-05-19 12:35:33 +00:00
|
|
|
hash = "sha256-LX4hyPme+mkNmPvrTHIT5Ow3QM8BTAB7MXSY1fa8tSk=";
|
2023-02-06 11:52:59 +00:00
|
|
|
};
|
2022-05-15 03:52:48 +00:00
|
|
|
|
2024-05-19 12:35:33 +00:00
|
|
|
vendorHash = "sha256-294lnUKnXNrN6fJ+98ub7LwsJ9aT+FzWCB3nryfAlCI=";
|
2023-07-10 21:53:45 +00:00
|
|
|
|
|
|
|
inherit overrideModAttrs;
|
2022-10-05 06:04:56 +00:00
|
|
|
|
2023-02-06 11:52:59 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
excludedPackages = [ "./cmd/copyright" ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
|
|
|
|
preCheck = ''
|
2024-05-19 12:35:33 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2023-02-06 11:52:59 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd tctl \
|
|
|
|
--bash <($out/bin/tctl completion bash) \
|
|
|
|
--zsh <($out/bin/tctl completion zsh)
|
|
|
|
'';
|
2023-07-10 21:53:45 +00:00
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
2023-07-24 14:44:55 +00:00
|
|
|
|
|
|
|
meta = metaCommon // {
|
|
|
|
mainProgram = "tctl";
|
|
|
|
};
|
2022-05-15 03:52:48 +00:00
|
|
|
};
|
2023-02-06 11:52:59 +00:00
|
|
|
in
|
|
|
|
symlinkJoin rec {
|
|
|
|
pname = "temporal-cli";
|
|
|
|
inherit (tctl) version;
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
paths = [
|
|
|
|
tctl-next
|
|
|
|
tctl
|
|
|
|
];
|
2022-05-15 03:52:48 +00:00
|
|
|
|
2023-07-10 21:53:24 +00:00
|
|
|
passthru = { inherit tctl tctl-next; };
|
|
|
|
|
2023-07-24 14:44:55 +00:00
|
|
|
meta = metaCommon // {
|
2023-02-06 11:52:59 +00:00
|
|
|
mainProgram = "temporal";
|
2023-07-24 14:44:55 +00:00
|
|
|
platforms = lib.unique (lib.concatMap (drv: drv.meta.platforms) paths);
|
2022-05-15 03:52:48 +00:00
|
|
|
};
|
|
|
|
}
|