nixpkgs/pkgs/by-name/te/temporal-cli/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

119 lines
2.8 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 = "1.0.0";
src = fetchFromGitHub {
owner = "temporalio";
repo = "cli";
rev = "v${version}";
hash = "sha256-y0C2z2iMMQSG5+xGngZ98+ixIgbvaQxPdAWuPbEbBAY=";
};
vendorHash = "sha256-zhGqDHdVGg7eGnw5L3eSyXKBTjp85ir5zrtf7HbXmC0=";
inherit overrideModAttrs;
nativeBuildInputs = [ installShellFiles ];
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 = ''
export HOME="$(mktemp -d)"
'';
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";
};
};
tctl = buildGoModule rec {
pname = "tctl";
version = "1.18.1";
src = fetchFromGitHub {
owner = "temporalio";
repo = "tctl";
rev = "v${version}";
hash = "sha256-LX4hyPme+mkNmPvrTHIT5Ow3QM8BTAB7MXSY1fa8tSk=";
};
vendorHash = "sha256-294lnUKnXNrN6fJ+98ub7LwsJ9aT+FzWCB3nryfAlCI=";
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);
};
}