Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporal-cli,tctl: pack as two seperated packages #342695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 0 additions & 118 deletions pkgs/applications/networking/cluster/temporal-cli/default.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
+ if !os.IsNotExist(err) && !os.IsPermission(err) {
panic(err)
}


57 changes: 57 additions & 0 deletions pkgs/by-name/tc/tctl/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
lib,
stdenv,
fetchFromGitHub,
buildGoModule,
installShellFiles,
}:

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=";

overrideModAttrs = old: {
# https://gitlab.com/cznic/libc/-/merge_requests/10
postBuild = ''
patch -p0 < ${./darwin-sandbox-fix.patch}
'';
};

nativeBuildInputs = [ installShellFiles ];

excludedPackages = [ "./cmd/copyright" ];

ldflags = [
"-s"
"-w"
];

preCheck = ''
export HOME="$(mktemp -d)"
'';

postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd tctl \
--bash <($out/bin/tctl completion bash) \
--zsh <($out/bin/tctl completion zsh)
'';

__darwinAllowLocalNetworking = true;

meta = {
description = "Command-line tool that you can use to interact with a Temporal Cluster";
homepage = "https://docs.temporal.io/docs/system-tools/tctl";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "tctl";
};
}
20 changes: 20 additions & 0 deletions pkgs/by-name/te/temporal-cli/darwin-sandbox-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go
+++ vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go
@@ -696,7 +696,7 @@ func init() {
// Load protocols
data, err := ioutil.ReadFile("/etc/protocols")
if err != nil {
- if !os.IsNotExist(err) {
+ if !os.IsNotExist(err) && !os.IsPermission(err) {
panic(err)
}

@@ -732,7 +732,7 @@ func init() {
// Load services
data, err = ioutil.ReadFile("/etc/services")
if err != nil {
- if !os.IsNotExist(err) {
+ if !os.IsNotExist(err) && !os.IsPermission(err) {
panic(err)
}

65 changes: 65 additions & 0 deletions pkgs/by-name/te/temporal-cli/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
lib,
stdenv,
fetchFromGitHub,
buildGoModule,
installShellFiles,
}:

buildGoModule rec {
pname = "temporal-cli";
version = "1.0.0";

src = fetchFromGitHub {
owner = "temporalio";
repo = "cli";
rev = "v${version}";
hash = "sha256-y0C2z2iMMQSG5+xGngZ98+ixIgbvaQxPdAWuPbEbBAY=";
};

vendorHash = "sha256-zhGqDHdVGg7eGnw5L3eSyXKBTjp85ir5zrtf7HbXmC0=";

overrideModAttrs = old: {
# https://gitlab.com/cznic/libc/-/merge_requests/10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we fetchpatch this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very sure. But it seems to come from #242721.

It seems like a patch for vendoring .

postBuild = ''
patch -p0 < ${./darwin-sandbox-fix.patch}
'';
};

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.isDarwin && stdenv.hostPlatform.isx86_64);

preCheck = ''
export HOME="$(mktemp -d)"
'';

postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd temporal \
--bash <($out/bin/temporal completion bash) \
--fish <($out/bin/temporal completion fish) \
--zsh <($out/bin/temporal completion zsh)
'';

__darwinAllowLocalNetworking = true;

meta = {
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 = lib.licenses.mit;
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "temporal";
};
}
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33132,8 +33132,6 @@ with pkgs;

temporal = callPackage ../applications/networking/cluster/temporal { };

temporal-cli = callPackage ../applications/networking/cluster/temporal-cli { };

temporalite = callPackage ../applications/networking/cluster/temporalite { };

tenacity = callPackage ../applications/audio/tenacity { };
Expand Down