nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 nixosTests,
6 testers,
7 temporal,
8 versionCheckHook,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "temporal";
13 version = "1.29.2";
14
15 src = fetchFromGitHub {
16 owner = "temporalio";
17 repo = "temporal";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-WiiezZ/2FgRte4BStIGHQhb5bHtfldi3TaIRG0xFtW0=";
20 };
21
22 vendorHash = "sha256-CdzcOE/J0gqUbq7BXPpLFyNPNbFTziR5j9GPdYPzv50=";
23
24 overrideModAttrs = old: {
25 # 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.
26 postBuild = ''
27 patch -p0 < ${./darwin-sandbox-fix.patch}
28 '';
29 };
30
31 excludedPackages = [ "./build" ];
32
33 env.CGO_ENABLED = 0;
34
35 tags = [ "test_dep" ];
36 ldflags = [
37 "-s"
38 "-w"
39 ];
40
41 # There too many integration tests.
42 doCheck = false;
43
44 installPhase = ''
45 runHook preInstall
46
47 mkdir -p $out/share
48 cp -r ./schema $out/share/
49
50 install -Dm755 "$GOPATH/bin/server" -T $out/bin/temporal-server
51 install -Dm755 "$GOPATH/bin/cassandra" -T $out/bin/temporal-cassandra-tool
52 install -Dm755 "$GOPATH/bin/sql" -T $out/bin/temporal-sql-tool
53 install -Dm755 "$GOPATH/bin/tdbg" -T $out/bin/tdbg
54
55 runHook postInstall
56 '';
57
58 nativeInstallCheckInputs = [
59 versionCheckHook
60 ];
61 versionCheckProgramArg = "--version";
62 doInstallCheck = true;
63
64 passthru.tests = {
65 inherit (nixosTests) temporal;
66 version = testers.testVersion {
67 package = temporal;
68 };
69 };
70
71 meta = {
72 description = "Microservice orchestration platform which enables developers to build scalable applications without sacrificing productivity or reliability";
73 homepage = "https://temporal.io";
74 changelog = "https://github.com/temporalio/temporal/releases/tag/v${finalAttrs.version}";
75 license = lib.licenses.mit;
76 maintainers = with lib.maintainers; [ jpds ];
77 mainProgram = "temporal-server";
78 };
79})