diff --git a/pkgs/by-name/te/temporal/darwin-sandbox-fix.patch b/pkgs/by-name/te/temporal/darwin-sandbox-fix.patch new file mode 100644 index 000000000000..b390d492467c --- /dev/null +++ b/pkgs/by-name/te/temporal/darwin-sandbox-fix.patch @@ -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) + } + diff --git a/pkgs/by-name/te/temporal/package.nix b/pkgs/by-name/te/temporal/package.nix index f2cc1a5cc3ec..c754df508f40 100644 --- a/pkgs/by-name/te/temporal/package.nix +++ b/pkgs/by-name/te/temporal/package.nix @@ -5,20 +5,28 @@ nixosTests, testers, temporal, + versionCheckHook, }: -buildGoModule rec { +buildGoModule (finalAttrs: { pname = "temporal"; version = "1.29.2"; src = fetchFromGitHub { owner = "temporalio"; repo = "temporal"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-WiiezZ/2FgRte4BStIGHQhb5bHtfldi3TaIRG0xFtW0="; }; - vendorHash = "sha256-HW2j8swbaWwU1i3udqlT8VyFreML6ZH14zWxF8L5NTQ="; + vendorHash = "sha256-CdzcOE/J0gqUbq7BXPpLFyNPNbFTziR5j9GPdYPzv50="; + + overrideModAttrs = old: { + # netdb.go allows /etc/protocols and /etc/services to not exist and happily proceeds, but it panic()s if they exist but return permission denied. + postBuild = '' + patch -p0 < ${./darwin-sandbox-fix.patch} + ''; + }; excludedPackages = [ "./build" ]; @@ -47,6 +55,12 @@ buildGoModule rec { runHook postInstall ''; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + passthru.tests = { inherit (nixosTests) temporal; version = testers.testVersion { @@ -57,9 +71,9 @@ buildGoModule rec { meta = { description = "Microservice orchestration platform which enables developers to build scalable applications without sacrificing productivity or reliability"; homepage = "https://temporal.io"; - changelog = "https://github.com/temporalio/temporal/releases/tag/v${version}"; + changelog = "https://github.com/temporalio/temporal/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ jpds ]; mainProgram = "temporal-server"; }; -} +})