nixpkgs/pkgs/applications/networking/cluster/temporal-cli/default.nix
Andrew Marshall 01b07afeae temporal-cli: Disable tests on x86_64-darwin due to Rosetta 2
They succeed for me (with multiple runs) on x86_64-darwin native (no
Rosetta 2). Afaik, Hydra performs x86_64-darwin builds on Rosetta 2 on
aarch64-darwin. I do not have the hardware to reproduce this (and it
could be a build issue), so let’s disable the tests for now and go from
there.
2023-07-31 18:34:02 -04:00

118 lines
2.7 KiB
Nix

{ lib, fetchFromGitHub, buildGoModule, installShellFiles, symlinkJoin, stdenv }:
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 = "0.9.0";
src = fetchFromGitHub {
owner = "temporalio";
repo = "cli";
rev = "v${version}";
hash = "sha256-zgi1wNx7fWf/iFGKaVffcXnC90vUz+mBT6HhCGdXMa0=";
};
vendorHash = "sha256-EX1T3AygarJn4Zae2I8CHQrZakmbNF1OwE4YZFF+nKc=";
inherit overrideModAttrs;
nativeBuildInputs = [ installShellFiles ];
excludedPackages = [ "./cmd/docgen" "./tests" ];
ldflags = [
"-s"
"-w"
"-X github.com/temporalio/cli/headers.Version=${version}"
];
# Tests fail with x86 on macOS Rosetta 2
doCheck = !(stdenv.isDarwin && stdenv.hostPlatform.isx86_64);
preCheck = ''
export HOME=$(mktemp -d)
'';
postInstall = ''
installShellCompletion --cmd temporal \
--bash <($out/bin/temporal completion bash) \
--zsh <($out/bin/temporal completion zsh)
'';
__darwinAllowLocalNetworking = true;
meta = metaCommon // {
mainProgram = "temporal";
};
};
tctl = buildGoModule rec {
pname = "tctl";
version = "1.18.0";
src = fetchFromGitHub {
owner = "temporalio";
repo = "tctl";
rev = "v${version}";
hash = "sha256-LcBKkx3mcDOrGT6yJx98CSgxbwskqGPWqOzHWOu6cig=";
};
vendorHash = "sha256-5wCIY95mJ6+FCln4yBu+fM4ZcsxBGcXkCvxjGzt0+dM=";
inherit overrideModAttrs;
nativeBuildInputs = [ installShellFiles ];
excludedPackages = [ "./cmd/copyright" ];
ldflags = [ "-s" "-w" ];
preCheck = ''
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";
};
};
in
symlinkJoin rec {
pname = "temporal-cli";
inherit (tctl) version;
name = "${pname}-${version}";
paths = [
tctl-next
tctl
];
passthru = { inherit tctl tctl-next; };
meta = metaCommon // {
mainProgram = "temporal";
platforms = lib.unique (lib.concatMap (drv: drv.meta.platforms) paths);
};
}