temporal-cli: Fix Darwin builds with sandbox enabled

Unfortunately one of the issues is within a dependency, so have to do
some awkward patching of the go-modules. This patch is pending merge to
the upstream dep and will hopefully eventually trickle down. We do *not*
optionally apply the patch for Darwin only because then we would have a
different hash per system, which seems even more awkward.

+37 -2
+20
pkgs/applications/networking/cluster/temporal-cli/darwin-sandbox-fix.patch
··· 1 + --- vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go 2 + +++ vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go 3 + @@ -696,7 +696,7 @@ func init() { 4 + // Load protocols 5 + data, err := ioutil.ReadFile("/etc/protocols") 6 + if err != nil { 7 + - if !os.IsNotExist(err) { 8 + + if !os.IsNotExist(err) && !os.IsPermission(err) { 9 + panic(err) 10 + } 11 + 12 + @@ -732,7 +732,7 @@ func init() { 13 + // Load services 14 + data, err = ioutil.ReadFile("/etc/services") 15 + if err != nil { 16 + - if !os.IsNotExist(err) { 17 + + if !os.IsNotExist(err) && !os.IsPermission(err) { 18 + panic(err) 19 + } 20 +
+17 -2
pkgs/applications/networking/cluster/temporal-cli/default.nix
··· 1 1 { lib, fetchFromGitHub, buildGoModule, installShellFiles, symlinkJoin }: 2 2 3 3 let 4 + overrideModAttrs = old: { 5 + # https://gitlab.com/cznic/libc/-/merge_requests/10 6 + postBuild = '' 7 + patch -p0 < ${./darwin-sandbox-fix.patch} 8 + ''; 9 + }; 10 + 4 11 tctl-next = buildGoModule rec { 5 12 pname = "tctl-next"; 6 13 version = "0.9.0"; ··· 12 19 hash = "sha256-zgi1wNx7fWf/iFGKaVffcXnC90vUz+mBT6HhCGdXMa0="; 13 20 }; 14 21 15 - vendorHash = "sha256-muTNwK2Sb2+0df/6DtAzT14gwyuqa13jkG6eQaqhSKg="; 22 + vendorHash = "sha256-EX1T3AygarJn4Zae2I8CHQrZakmbNF1OwE4YZFF+nKc="; 23 + 24 + inherit overrideModAttrs; 16 25 17 26 nativeBuildInputs = [ installShellFiles ]; 18 27 ··· 33 42 --bash <($out/bin/temporal completion bash) \ 34 43 --zsh <($out/bin/temporal completion zsh) 35 44 ''; 45 + 46 + __darwinAllowLocalNetworking = true; 36 47 }; 37 48 38 49 tctl = buildGoModule rec { ··· 46 57 hash = "sha256-LcBKkx3mcDOrGT6yJx98CSgxbwskqGPWqOzHWOu6cig="; 47 58 }; 48 59 49 - vendorHash = "sha256-BUYEeC5zli++OxVFgECJGqJkbDwglLppSxgo+4AqOb0="; 60 + vendorHash = "sha256-5wCIY95mJ6+FCln4yBu+fM4ZcsxBGcXkCvxjGzt0+dM="; 61 + 62 + inherit overrideModAttrs; 50 63 51 64 nativeBuildInputs = [ installShellFiles ]; 52 65 ··· 63 76 --bash <($out/bin/tctl completion bash) \ 64 77 --zsh <($out/bin/tctl completion zsh) 65 78 ''; 79 + 80 + __darwinAllowLocalNetworking = true; 66 81 }; 67 82 in 68 83 symlinkJoin rec {