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: Fix Darwin builds with sandbox enabled #242721

Merged
merged 2 commits into from
Jul 23, 2023
Merged
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
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)
}

21 changes: 19 additions & 2 deletions pkgs/applications/networking/cluster/temporal-cli/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, symlinkJoin }:

let
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";
Expand All @@ -12,7 +19,9 @@ let
hash = "sha256-zgi1wNx7fWf/iFGKaVffcXnC90vUz+mBT6HhCGdXMa0=";
};

vendorHash = "sha256-muTNwK2Sb2+0df/6DtAzT14gwyuqa13jkG6eQaqhSKg=";
vendorHash = "sha256-EX1T3AygarJn4Zae2I8CHQrZakmbNF1OwE4YZFF+nKc=";

inherit overrideModAttrs;

nativeBuildInputs = [ installShellFiles ];

Expand All @@ -33,6 +42,8 @@ let
--bash <($out/bin/temporal completion bash) \
--zsh <($out/bin/temporal completion zsh)
'';

__darwinAllowLocalNetworking = true;
};

tctl = buildGoModule rec {
Expand All @@ -46,7 +57,9 @@ let
hash = "sha256-LcBKkx3mcDOrGT6yJx98CSgxbwskqGPWqOzHWOu6cig=";
};

vendorHash = "sha256-BUYEeC5zli++OxVFgECJGqJkbDwglLppSxgo+4AqOb0=";
vendorHash = "sha256-5wCIY95mJ6+FCln4yBu+fM4ZcsxBGcXkCvxjGzt0+dM=";

inherit overrideModAttrs;

nativeBuildInputs = [ installShellFiles ];

Expand All @@ -63,6 +76,8 @@ let
--bash <($out/bin/tctl completion bash) \
--zsh <($out/bin/tctl completion zsh)
'';

__darwinAllowLocalNetworking = true;
};
in
symlinkJoin rec {
Expand All @@ -75,6 +90,8 @@ symlinkJoin rec {
tctl
];

passthru = { inherit tctl tctl-next; };

meta = with lib; {
description = "Temporal CLI";
homepage = "https://temporal.io";
Expand Down