nixpkgs/pkgs/by-name/te/temporal-cli/package.nix

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

119 lines
2.8 KiB
Nix
Raw Normal View History

{ lib, fetchFromGitHub, buildGoModule, installShellFiles, symlinkJoin, stdenv }:
2022-05-15 03:52:48 +00:00
let
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 ];
};
overrideModAttrs = old: {
# https://gitlab.com/cznic/libc/-/merge_requests/10
postBuild = ''
patch -p0 < ${./darwin-sandbox-fix.patch}
'';
};
tctl-next = buildGoModule rec {
pname = "tctl-next";
version = "1.0.0";
src = fetchFromGitHub {
owner = "temporalio";
repo = "cli";
rev = "v${version}";
hash = "sha256-y0C2z2iMMQSG5+xGngZ98+ixIgbvaQxPdAWuPbEbBAY=";
};
vendorHash = "sha256-zhGqDHdVGg7eGnw5L3eSyXKBTjp85ir5zrtf7HbXmC0=";
inherit overrideModAttrs;
nativeBuildInputs = [ installShellFiles ];
2023-05-13 04:37:50 +00:00
excludedPackages = [ "./cmd/docgen" "./tests" ];
ldflags = [
"-s"
"-w"
"-X github.com/temporalio/cli/temporalcli.Version=${version}"
];
# Tests fail with x86 on macOS Rosetta 2
doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64);
preCheck = ''
2024-05-19 12:35:33 +00:00
export HOME="$(mktemp -d)"
'';
2022-05-15 03:52:48 +00:00
postInstall = ''
installShellCompletion --cmd temporal \
--bash <($out/bin/temporal completion bash) \
--fish <($out/bin/temporal completion fish) \
--zsh <($out/bin/temporal completion zsh)
'';
__darwinAllowLocalNetworking = true;
meta = metaCommon // {
mainProgram = "temporal";
};
2022-05-15 03:52:48 +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
src = fetchFromGitHub {
owner = "temporalio";
repo = "tctl";
rev = "v${version}";
2024-05-19 12:35:33 +00:00
hash = "sha256-LX4hyPme+mkNmPvrTHIT5Ow3QM8BTAB7MXSY1fa8tSk=";
};
2022-05-15 03:52:48 +00:00
2024-05-19 12:35:33 +00:00
vendorHash = "sha256-294lnUKnXNrN6fJ+98ub7LwsJ9aT+FzWCB3nryfAlCI=";
inherit overrideModAttrs;
2022-10-05 06:04:56 +00:00
nativeBuildInputs = [ installShellFiles ];
excludedPackages = [ "./cmd/copyright" ];
ldflags = [ "-s" "-w" ];
preCheck = ''
2024-05-19 12:35:33 +00:00
export HOME="$(mktemp -d)"
'';
postInstall = ''
installShellCompletion --cmd tctl \
--bash <($out/bin/tctl completion bash) \
--zsh <($out/bin/tctl completion zsh)
'';
__darwinAllowLocalNetworking = true;
meta = metaCommon // {
mainProgram = "tctl";
};
2022-05-15 03:52:48 +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
passthru = { inherit tctl tctl-next; };
meta = metaCommon // {
mainProgram = "temporal";
platforms = lib.unique (lib.concatMap (drv: drv.meta.platforms) paths);
2022-05-15 03:52:48 +00:00
};
}